# HG changeset patch # User Rik # Date 1559661011 25200 # Node ID 1bad33112465f3f50ccbb957730446899edf03b5 # Parent 9e5c1d343a2c58040f3065fe9730e4087c9d6d5b Emit an error for invalid fieldnames of 0x0 struct array (bug #34967). * ov-struct.cc (subsref): Always perform dotref() to check that fieldname is valid. Only return a value, however, if map object is not empty. diff -r 9e5c1d343a2c -r 1bad33112465 libinterp/octave-value/ov-struct.cc --- a/libinterp/octave-value/ov-struct.cc Mon Jun 03 19:03:15 2019 -0700 +++ b/libinterp/octave-value/ov-struct.cc Tue Jun 04 08:10:11 2019 -0700 @@ -157,12 +157,10 @@ case '.': { - if (map.numel () > 0) - { - const Cell t = dotref (idx.front ()); - - retval(0) = (t.numel () == 1) ? t(0) : octave_value (t, true); - } + const Cell t = dotref (idx.front ()); + + if (! map.isempty ()) + retval(0) = (t.numel () == 1) ? t(0) : octave_value (t, true); } break;