diff src/ov-str-mat.cc @ 6717:b319df52ba87

[project @ 2007-06-13 20:25:53 by jwe]
author jwe
date Wed, 13 Jun 2007 20:25:53 +0000
parents 12c50a17f20f
children fa3c21cdf3bc
line wrap: on
line diff
--- a/src/ov-str-mat.cc	Wed Jun 13 15:40:07 2007 +0000
+++ b/src/ov-str-mat.cc	Wed Jun 13 20:25:53 2007 +0000
@@ -333,20 +333,34 @@
 	      for (int i = 0; i < mdims; i++)
 		is >> dv(i);
 
-	      charNDArray tmp(dv);
-	      char *ftmp = tmp.fortran_vec ();
+	      if (is)
+		{
+		  charNDArray tmp(dv);
+
+		  if (tmp.is_empty ())
+		    matrix = tmp;
+		  else
+		    {
+		      char *ftmp = tmp.fortran_vec ();
 
-	      // Skip the return line
-	      if (! is.read (ftmp, 1))
-		return false;
+		      // Skip the return line
+		      if (! is.read (ftmp, 1))
+			return false;
 
-	      if (! is.read (ftmp, dv.numel ()) || !is)
+		      if (! is.read (ftmp, dv.numel ()) || !is)
+			{
+			  error ("load: failed to load string constant");
+			  success = false;
+			}
+		      else
+			matrix = tmp;
+		    }
+		}
+	      else
 		{
-		  error ("load: failed to load string constant");
+		  error ("load: failed to read dimensions");
 		  success = false;
 		}
-	      else
-		matrix = tmp;
 	    }
 	  else
 	    {