Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix AttributeError: 'NoneType' object has no attribute #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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