Skip to content

Commit c1e2369

Browse files
committed
fix: avoid trying to get from NoneType
1 parent 95a553e commit c1e2369

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/vsc/utils/cache.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,13 @@ def load(self, key):
143143
144144
@returns: (timestamp, data) if there is data for the given key, None otherwise.
145145
"""
146-
return self.new_shelf.get(key, None) or self.shelf.get(key, None)
146+
result = None
147+
if self.new_shelf is not None:
148+
result = self.new_shelf.get(key, None)
149+
if result is None and self.shelf is not None:
150+
return self.shelf.get(key, None)
151+
152+
return result
147153

148154
def retain(self):
149155
"""Retain non-updated data on close."""

0 commit comments

Comments
 (0)