still append None when an optional spec is missed

This commit is contained in:
jesopo 2020-01-24 14:26:46 +00:00
parent fa98b72fd5
commit 52c3cab627

View file

@ -54,7 +54,7 @@ class Module(ModuleManager.BaseModule):
options = self._spec_chunk(server, channel, types, args) options = self._spec_chunk(server, channel, types, args)
found = False found = None
first_error = None first_error = None
for type, chunk, n, error in options: for type, chunk, n, error in options:
if error and not first_error: if error and not first_error:
@ -65,7 +65,9 @@ class Module(ModuleManager.BaseModule):
args = args[n:] args = args[n:]
if len(types) > 1: if len(types) > 1:
chunk = [type, chunk] chunk = [type, chunk]
out.append(chunk) found = chunk
break
out.append(found)
if not optional and not found: if not optional and not found:
error = first_error or "Invalid arguments" error = first_error or "Invalid arguments"