changeset 18616:2ce1f1966fc3 stable

textscan.m: Fix undefined whitespace error with empty format input (bug #41824). * textscan.m: Define whitespace variable even when format string is empty. Add %!test for behavior.
author Sergey Plotnikov
date Tue, 11 Mar 2014 21:44:38 +0100
parents 02a61d7c2de0
children 51a0d1c1023c
files scripts/io/textscan.m
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/io/textscan.m	Thu Mar 20 21:57:14 2014 -0700
+++ b/scripts/io/textscan.m	Tue Mar 11 21:44:38 2014 +0100
@@ -1,4 +1,4 @@
-## Copyright (C) 2010-2013 Ben Abbott
+## Copyright (C) 2010-2014 Ben Abbott
 ##
 ## This file is part of Octave.
 ##
@@ -135,6 +135,7 @@
     if (! (isempty (args{ipos+1}) && has_str_fmt))
       args{ipos+1} = unique ([" ", args{ipos+1}]);
     endif
+    whitespace = args{ipos+1};
   endif
 
   if (! any (strcmpi (args, "delimiter")))
@@ -661,3 +662,7 @@
 %! unlink (f);
 %! assert (msg1, lasterr);
 
+%% Bug #41824
+%!test
+%! assert (textscan ("123", "", "whitespace", " "){:}, 123);
+