liamcain / AutoFileName

Sublime Text plugin that autocompletes filenames
514 stars 78 forks source link

IndexError! #117

Open ryanpcmcquen opened 4 years ago

ryanpcmcquen commented 4 years ago

  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1381, in run_
    self.view.end_edit(edit)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime.py", line 1072, in end_edit
    sublime_api.view_end_edit(self.view_id, edit.edit_token)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 846, in on_modified
    run_view_callbacks('on_modified', view_id)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 665, in run_view_callbacks
    callback(v, *args)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 147, in profiler
    return event_handler(*args)
  File "/Users/rmcquen/Library/Application Support/Sublime Text 3/Installed Packages/AutoFileName.sublime-package/autofilename.py", line 162, in on_modified
    sel = view.sel()[0].a
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime.py", line 846, in __getitem__
    raise IndexError()
IndexError```
ryanpcmcquen commented 4 years ago

All these calls:

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

Should be wrapped like so:

try:
    sel = view.sel()[0].a
except IndexError:
    pass
jingyuexing commented 3 years ago

SAME ERROR!

rchl commented 2 years ago

This should be fixed as it can randomly break ST and even affect other packages.

@liamcain do you have time to address it? Alternatively are you open to transferring this repo to https://github.com/SublimeText/ org?