From 51859d62e86e7cb4a677276f6530e91ac249424b Mon Sep 17 00:00:00 2001 From: TheSecEng Date: Tue, 25 May 2021 15:58:22 -0700 Subject: [PATCH] fix: case when window or active_view is none --- PrettyJson.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/PrettyJson.py b/PrettyJson.py index 1422d48..c1a9d2c 100644 --- a/PrettyJson.py +++ b/PrettyJson.py @@ -375,18 +375,26 @@ class JqQueryPrettyJson(sublime_plugin.WindowCommand): if not self.window: return + view = self.window.active_view() + if not view: + return + as_json = s.get('as_json', ['JSON']) 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): if not self.window: return + view = self.window.active_view() + if not view: + return + as_json = s.get('as_json', ['JSON']) 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):