changeset 25628:a0d642f24349 stable

Parse empty struct input correctly (bug #54318). * inputParser.m: When input is an empty struct, skip this argument.
author Rik <rik@octave.org>
date Mon, 16 Jul 2018 11:46:24 -0700
parents 3464c423ac10
children f092ffdc7770 b96ab99e67bb
files scripts/miscellaneous/inputParser.m
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/inputParser.m	Fri Jul 13 15:53:29 2018 -0400
+++ b/scripts/miscellaneous/inputParser.m	Mon Jul 16 11:46:24 2018 -0700
@@ -448,6 +448,9 @@
 
         if (this.StructExpand && isstruct (name) && isscalar (name))
           expanded_options = [fieldnames(name) struct2cell(name)]'(:);
+          if (isempty (expanded_options))
+            continue;  # empty, continue to next argument
+          endif
           n_new_args = numel (expanded_options) -1;
           pnargin += n_new_args;
           varargin(vidx+n_new_args+1:pnargin) = varargin(vidx+1:end);