From df031f5813c60ee001466b0db949b9d06f0c9b72 Mon Sep 17 00:00:00 2001 From: Raoul Wols Date: Sun, 6 Aug 2017 11:31:49 +0200 Subject: [PATCH] Account for syntax being none in some cases In some cases, the settings object or the syntax may be None. We check for those cases now and just return False (not applicable). --- AutoComplete.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AutoComplete.py b/AutoComplete.py index d4f9d58..286be8a 100644 --- a/AutoComplete.py +++ b/AutoComplete.py @@ -6,7 +6,12 @@ class AutoComplete(sublime_plugin.ViewEventListener): @classmethod def is_applicable(cls, settings): - return settings.get("syntax", "").endswith("CMake.sublime-syntax") + if not settings: + return False + syntax = settings.get("syntax", None) + if not syntax: + return False + return syntax.endswith("CMake.sublime-syntax") def on_query_completions(self, prefix, locations): for point in locations: