From 276a3fe01bc386f5d7d03c3068f61db4051bb5e3 Mon Sep 17 00:00:00 2001 From: Maria Dimashova Date: Thu, 24 May 2012 16:52:14 +0000 Subject: [PATCH] fixed #1981 --- modules/ml/src/data.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ml/src/data.cpp b/modules/ml/src/data.cpp index 9bf4674c4a..01d51daee2 100644 --- a/modules/ml/src/data.cpp +++ b/modules/ml/src/data.cpp @@ -195,12 +195,13 @@ int CvMLData::read_csv(const char* filename) ptr++; } + cols_count++; + if ( cols_count == 0) { fclose(file); return -1; } - cols_count++; // create temporary memory storage to store the whole database el_ptr = new float[cols_count];