diff scripts/image/private/__imwrite__.m @ 17234:0b8f78cdc5cd

imwrite: give error if image is an empty or sparse matrix.
author Carnë Draug <carandraug@octave.org>
date Tue, 13 Aug 2013 06:20:02 +0100
parents 46805642048f
children b1a09f72a520
line wrap: on
line diff
--- a/scripts/image/private/__imwrite__.m	Mon Aug 12 18:55:38 2013 -0700
+++ b/scripts/image/private/__imwrite__.m	Tue Aug 13 06:20:02 2013 +0100
@@ -26,6 +26,10 @@
 
   if (nargin < 2 || ! (isnumeric (img) || islogical (img)))
     print_usage ("imwrite");
+  elseif (isempty (img))
+    error ("imwrite: invalid empty image");
+  elseif (issparse (img) || issparse (map))
+    error ("imwrite: sparse images are not supported");
   endif
 
   [filename, ext, map, param_list] = imwrite_filename (varargin{:});