# HG changeset patch # User Carnë Draug # Date 1376711061 -3600 # Node ID b1a09f72a520f556284544be525ceeb106e11a00 # Parent 53f1d5bb58bcdbce7424afcf893ed55c0866e138 imwrite: fix input checking for colormap (bug #39791) diff -r 53f1d5bb58bc -r b1a09f72a520 scripts/image/private/__imwrite__.m --- a/scripts/image/private/__imwrite__.m Fri Aug 16 18:36:49 2013 -0700 +++ b/scripts/image/private/__imwrite__.m Sat Aug 17 04:44:21 2013 +0100 @@ -26,14 +26,16 @@ if (nargin < 2 || ! (isnumeric (img) || islogical (img))) print_usage ("imwrite"); - elseif (isempty (img)) + endif + + [filename, ext, map, param_list] = imwrite_filename (varargin{:}); + + if (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{:}); - if (rem (numel (param_list), 2) != 0) error ("imwrite: no pair for all arguments (odd number left)"); endif