aboutsummaryrefslogtreecommitdiff
path: root/src/IRCLine.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-03-08 23:35:52 +0000
committerGravatar jesopo2019-03-08 23:35:52 +0000
commit5c5b4ef13931ca50ca0864d65237993d94a493a5 (patch)
tree92251343e98ebac746c50eeef37595248da2b852 /src/IRCLine.py
parentHandle trying to strip colours from a PRIVMSG/NOTICE that has no message (diff)
signature
Handle negative (end-relative) indexes being given to IRCArgs.get
Diffstat (limited to 'src/IRCLine.py')
-rw-r--r--src/IRCLine.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/IRCLine.py b/src/IRCLine.py
index 970c2861..d388b463 100644
--- a/src/IRCLine.py
+++ b/src/IRCLine.py
@@ -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