Index: trunk/Mars/mcore/fits.h
===================================================================
--- trunk/Mars/mcore/fits.h	(revision 17143)
+++ trunk/Mars/mcore/fits.h	(revision 17144)
@@ -973,5 +973,5 @@
     }
 
-    bool SetPtrAddress(const string &name, void *ptr)
+    bool SetPtrAddress(const string &name, void *ptr, size_t cnt=0)
     {
         if (fTable.cols.count(name)==0)
@@ -979,4 +979,17 @@
             ostringstream str;
             str <<"SetPtrAddress('" << name << "') - Column not found." << endl;
+#ifdef __EXCEPTIONS
+            throw runtime_error(str.str());
+#else
+            gLog << ___err___ << "ERROR - " << str.str() << endl;
+            return false;
+#endif
+        }
+
+        if (cnt && cnt!=fTable.cols[name].num)
+        {
+            ostringstream str;
+            str << "SetPtrAddress('" << name << "') - Element count mismatch: expected "
+                << fTable.cols[name].num << " from header, got " << cnt << endl;
 #ifdef __EXCEPTIONS
             throw runtime_error(str.str());
