# HG changeset patch # User Mike Miller # Date 1470988459 25200 # Node ID a511d43e1fc000fc033b8881b99fec086382f8d3 # Parent 2461b86cb8fb49690605062a52e0d41e685ea66b pyobject.subsref: avoid attempting to index on empty index range * @pyobject/subsref.m: Avoid passing a bad index into __getitem__ when indexing either a{:} on an empty sequence or a{[]} on any sequence. diff -r 2461b86cb8fb -r a511d43e1fc0 @pyobject/subsref.m --- a/@pyobject/subsref.m Fri Aug 12 00:45:39 2016 -0700 +++ b/@pyobject/subsref.m Fri Aug 12 00:54:19 2016 -0700 @@ -77,7 +77,9 @@ endif gi = pycall ("getattr", x, "__getitem__"); # x.__getitem__ - if (isnumeric (ind) && length (ind) > 1) + if (isempty (ind) && x_is_sequence) + r = pyeval ("None"); + elseif (isnumeric (ind) && length (ind) > 1) r = {}; for k = 1:length (ind) r(end+1) = pycall (gi, ind(k));