comparison libinterp/octave-value/ov-classdef.cc @ 20125:274b52724931

Stop segfault when using empty indexing of a classdef object. * ov-classdef.cc (cdef_object_array::subsref): Emit an error if '()' empty indexing is used.
author Rik <rik@octave.org>
date Thu, 23 Apr 2015 17:03:14 -0700
parents 8b501a0db1e9
children
comparison
equal deleted inserted replaced
20124:6ee26f894346 20125:274b52724931
1626 case '(': 1626 case '(':
1627 { 1627 {
1628 const octave_value_list& ival = idx.front (); 1628 const octave_value_list& ival = idx.front ();
1629 bool is_scalar = true; 1629 bool is_scalar = true;
1630 Array<idx_vector> iv (dim_vector (1, ival.length ())); 1630 Array<idx_vector> iv (dim_vector (1, ival.length ()));
1631
1632 if (ival.empty ())
1633 {
1634 ::error ("can't index %s object(s) with empty parentheses",
1635 class_name ().c_str ());
1636 break;
1637 }
1631 1638
1632 for (int i = 0; ! error_state && i < ival.length (); i++) 1639 for (int i = 0; ! error_state && i < ival.length (); i++)
1633 { 1640 {
1634 iv(i) = ival(i).index_vector (); 1641 iv(i) = ival(i).index_vector ();
1635 if (! error_state) 1642 if (! error_state)