# HG changeset patch # User Carnë Draug # Date 1376711061 -3600 # Node ID b1a09f72a520f556284544be525ceeb106e11a00 # Parent 53f1d5bb58bcdbce7424afcf893ed55c0866e138 imwrite: fix input checking for colormap (bug #39791) diff --git a/scripts/image/private/__imwrite__.m b/scripts/image/private/__imwrite__.m --- a/scripts/image/private/__imwrite__.m +++ b/scripts/image/private/__imwrite__.m @@ -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