comparison liboctave/util/lo-utils.cc @ 20148:4a41b7d426b6 stable

Fix loading of ASCII files with NA values in final column (bug #44967). * lo-utils.cc (read_inf_nan_na): Check that last character read was not an EOF indicator (-1) before attempting to put it back on the stream.
author Rik <rik@octave.org>
date Fri, 01 May 2015 08:29:52 -0700
parents 4197fc428c7d
children 3db899f1d54c
comparison
equal deleted inserted replaced
20147:f0a8c1bc3b60 20148:4a41b7d426b6
237 if (c2 == 'n' || c2 == 'N') 237 if (c2 == 'n' || c2 == 'N')
238 val = std::numeric_limits<T>::quiet_NaN (); 238 val = std::numeric_limits<T>::quiet_NaN ();
239 else 239 else
240 { 240 {
241 val = octave_numeric_limits<T>::NA (); 241 val = octave_numeric_limits<T>::NA ();
242 is.putback (c2); 242 if (c2 != EOF)
243 is.putback (c2);
243 } 244 }
244 } 245 }
245 else 246 else
246 is.setstate (std::ios::failbit); 247 is.setstate (std::ios::failbit);
247 } 248 }