aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2015-10-29 21:57:54 +0100
committerTollef Fog Heen <tfheen@err.no>2015-10-29 21:57:54 +0100
commit9e25dbdfb3ccdd0c3975ecff9c9f3d947b700844 (patch)
treec6785be2aada9794a99f7c1c9a746442500267ad /wee_slack.py
parent8d22cb0ed22059ee9c4cd13e1977a98a3cfea129 (diff)
downloadwee-slack-9e25dbdfb3ccdd0c3975ecff9c9f3d947b700844.tar.gz
Make sure current_position isn't negative
We use current_position as an index into the current text on the line. Make sure it's never negative. This prevents a backtrace when trying to complete with an empty string.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 84bf17d..c789b43 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1686,6 +1686,8 @@ def complete_next_cb(data, buffer, command):
# If we're on a non-word, look left for something to complete
while current_pos >= 0 and input[current_pos] != '@' and not input[current_pos].isalnum():
current_pos = current_pos - 1
+ if current_pos < 0:
+ current_pos = 0
for l in range(current_pos, 0, -1):
if input[l] != '@' and not input[l].isalnum():
word_start = l + 1