storage: fix convert_version_18

This commit is contained in:
SomberNight 2019-03-01 19:54:09 +01:00
parent 9ecb504739
commit b134f04fef
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9

View file

@ -105,6 +105,12 @@ class JsonDB(PrintError):
self.data[key] = copy.deepcopy(value)
return True
elif key in self.data:
# clear current contents in case of references
cur_val = self.data[key]
clear_method = getattr(cur_val, "clear", None)
if callable(clear_method):
clear_method()
# pop from dict to delete key
self.data.pop(key)
return True
return False