Mercurial > octave
changeset 24685:d0221e3675ef
isprop.m: return false for abbreviated property names
* isprop.m: make "Octave:abbreviated-property-match" warning an error before
trying to get the property and then restore its previous state. Restore
lasterr in case an error occured.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Mon, 05 Feb 2018 15:27:55 +0100 |
parents | 037ace76257d |
children | 21e97b50989d |
files | scripts/plot/util/isprop.m |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/isprop.m Sun Feb 04 18:44:18 2018 +0100 +++ b/scripts/plot/util/isprop.m Mon Feb 05 15:27:55 2018 +0100 @@ -38,15 +38,27 @@ error ("isprop: PROP name must be a string"); endif + oldwarn = warning ("error", "Octave:abbreviated-property-match"); + [olderr, oldid] = lasterr (); + restore_lasterr = false; + res = false (size (obj)); for i = 1:numel (res) if (ishghandle (obj(i))) try v = get (obj(i), prop); res(i) = true; + catch + restore_lasterr = true; end_try_catch endif endfor + + if (restore_lasterr) + lasterr (olderr, oldid); + endif + + warning (oldwarn); endfunction