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 Oct 13, 2017
1 parent 880279d commit 2f927f9
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 @@ -234,6 +234,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 @@ -264,11 +266,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 2f927f9

Please sign in to comment.