Skip to content

Commit 2336ee5

Browse files
committed
Another weird Sublime view settings case
Another situation where Sublime returns None from the settings dictionary via "get" when it should return the default or the actual value. This seems to be some kind of race condition as we never set the object in the settings file None, and this isn't the first time I've seen this. In this case, I am not certain if the object is already in the view or not, but if it isn't, we should have used the default value of "{}", and if it was, we should have pulled the dictionary object, but isntead we got None which we never set.
1 parent 7e983cd commit 2336ee5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

color_helper_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ def fmt_float(f, p=0):
157157
def get_rules(view):
158158
"""Get auto-popup scope rule."""
159159

160-
rules = view.settings().get("color_helper.scan", {})
160+
rules = view.settings().get("color_helper.scan")
161161

162-
return rules if rules.get("enabled", False) else None
162+
return rules if rules is not None and rules.get("enabled", False) else None
163163

164164

165165
def get_scope(view, rules, skip_sel_check=False):

0 commit comments

Comments
 (0)