Handle negative (end-relative) indexes being given to IRCArgs.get
This commit is contained in:
parent
4f74ca4c0c
commit
5c5b4ef139
1 changed files with 4 additions and 1 deletions
|
@ -9,7 +9,10 @@ class IRCArgs(object):
|
||||||
self._args = args
|
self._args = args
|
||||||
|
|
||||||
def get(self, index: int) -> typing.Optional[str]:
|
def get(self, index: int) -> typing.Optional[str]:
|
||||||
if len(self._args) > index:
|
if index < 0:
|
||||||
|
if len(self._args) > (abs(index)-1):
|
||||||
|
return self._args[index]
|
||||||
|
elif len(self._args) > index:
|
||||||
return self._args[index]
|
return self._args[index]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue