changeset 21262:cf2eae837cc8

Fix imshow segfault when data cannot be converted to appropriate type (bug #46933). * graphics.cc (convert_cdata): Replace error with a warning when data can not be converted to an appropriate type.
author Rik <rik@octave.org>
date Mon, 15 Feb 2016 11:04:52 -0800
parents f982cfe3df03
children dfce76507f4b
files libinterp/corefcn/graphics.cc
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Tue Jan 26 15:52:21 2016 +1100
+++ b/libinterp/corefcn/graphics.cc	Mon Feb 15 11:04:52 2016 -0800
@@ -959,7 +959,13 @@
   else if (cdata.is_bool_type ())
     CONVERT_CDATA_1 (boolNDArray, bool_, false);
   else
-    error ("unsupported type for cdata (= %s)", cdata.type_name ().c_str ());
+    {
+      // Don't throw an error; leads to an incomplete FLTK object (bug #46933).
+      warning ("unsupported type for cdata (= %s).  "
+               "Valid types are uint8, uint16, double, single, and bool.",
+               cdata.type_name ().c_str ());
+      a = NDArray (dv, 0);  // return 0 instead
+    }
 
 #undef CONVERT_CDATA_1