rumly111 / simpleifdef

Sublime Text 3 plugin to highlight #ifdef-#else-#endif

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IndexError thrown on empty selection

rwols opened this issue · comments

cursor = view.sel()[0].a

this line may throw when the selection is empty:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 389, in run_callback
    expr()
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 513, in <lambda>
    run_callback('on_selection_modified', callback, lambda: callback.on_selection_modified(v))
  File "simpleifdef in /Users/raoulwols/Library/Application Support/Sublime Text 3/Installed Packages/Simple Ifdef.sublime-package", line 72, in on_selection_modified
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime.py", line 649, in __getitem__
    raise IndexError()
IndexError

Actually, this happens inside an output panel, you may want to ignore output panels completely.

Thanks for reporting. I wrapped this line inside a try...except block, most likely it should fix it.