Handle negative (end-relative) indexes being given to IRCArgs.get

This commit is contained in:
jesopo 2019-03-08 23:35:52 +00:00
parent 4f74ca4c0c
commit 5c5b4ef139

View file

@ -9,7 +9,10 @@ class IRCArgs(object):
self._args = args
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 None