diff --git a/MeteorClient.py b/MeteorClient.py index d16d69f..d44af2c 100644 --- a/MeteorClient.py +++ b/MeteorClient.py @@ -24,10 +24,12 @@ def add_data(self, collection, id, fields): def change_data(self, collection, id, fields, cleared): for key, value in fields.items(): - self.data[collection][id][key] = value + if collection in self.data and id in self.data[collection]: + self.data[collection][id][key] = value for key in cleared: - del self.data[collection][id][key] + if collection in self.data and id in self.data[collection] and key in self.data[collection][id]: + del self.data[collection][id][key] def remove_data(self, collection, id): del self.data[collection][id]