Mercurial > forge
changeset 10212:85b6fa4e5a94 octave-forge
inputParser/addSwitch: check for correct number of arguments
author | carandraug |
---|---|
date | Thu, 10 May 2012 11:24:35 +0000 |
parents | 57b61a543c35 |
children | d36489db1da9 |
files | main/general/inst/@inputParser/subsref.m |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/main/general/inst/@inputParser/subsref.m Thu May 10 11:13:09 2012 +0000 +++ b/main/general/inst/@inputParser/subsref.m Thu May 10 11:24:35 2012 +0000 @@ -217,8 +217,12 @@ endif def = false; case {'addSwitch'} - val = def_val; - def = false; + if ( numel (args) == 0 ) + val = def_val; + def = false; + else + print_usage(func); + endif otherwise error ("invalid index for reference of class %s", class (inPar) ); endswitch