Skip to content

Commit

Permalink
Attempt to fix AttributeError: 'NoneType' object has no attribute
Browse files Browse the repository at this point in the history
'views'. Issue:
aziz#43
  • Loading branch information
evandrocoan committed Jan 11, 2018
1 parent 89ec98e commit e777ebc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ansi.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ def detect_left_ansi(self, view):
sublime.set_timeout_async(partial(self.check_left_ansi, view), 50)

def check_left_ansi(self, view):
if not view:
return
if not self._is_view_valid(view):
self._del_event_listeners(view)
return
Expand Down Expand Up @@ -323,11 +325,13 @@ def detect_syntax_change(self, view):
view.window().run_command("undo_ansi")

def _is_view_valid(self, view):
if view.window() is None:
window = view.window()

if window is None:
return False
if view.window() not in sublime.windows():
if window not in sublime.windows():
return False
if view not in view.window().views():
if view not in window.views():
return False
return True

Expand Down

0 comments on commit e777ebc

Please sign in to comment.