fix: case when window or active_view is none

This commit is contained in:
TheSecEng 2021-05-25 15:58:22 -07:00
parent b7af550526
commit 51859d62e8
No known key found for this signature in database
GPG Key ID: 4D98046FE19FF417
1 changed files with 10 additions and 2 deletions

View File

@ -375,18 +375,26 @@ class JqQueryPrettyJson(sublime_plugin.WindowCommand):
if not self.window: if not self.window:
return return
view = self.window.active_view()
if not view:
return
as_json = s.get('as_json', ['JSON']) as_json = s.get('as_json', ['JSON'])
return any( return any(
syntax in self.window.active_view().settings().get('syntax') for syntax in as_json syntax in view.settings().get('syntax', '') for syntax in as_json
) )
def is_visible(self): def is_visible(self):
if not self.window: if not self.window:
return return
view = self.window.active_view()
if not view:
return
as_json = s.get('as_json', ['JSON']) as_json = s.get('as_json', ['JSON'])
return any( return any(
syntax in self.window.active_view().settings().get('syntax') for syntax in as_json syntax in view.settings().get('syntax', '') for syntax in as_json
) )
def run(self): def run(self):