Fix crash on variable

This commit is contained in:
Ruben van de Ven 2019-11-12 00:26:05 +01:00
parent b0c4a35242
commit 8f1a93f496

View file

@ -144,7 +144,7 @@ class Message(object):
self.logger.warn(f"Set variable, fetch {name}") self.logger.warn(f"Set variable, fetch {name}")
if not None in self.variableValues.values(): if not None in self.variableValues.values():
self.logger.warn(f"now fetch {name}") self.logger.warn(f"now fetch {name} for {self.id}")
asyncio.get_event_loop().create_task(self.getAudioFilePath()) asyncio.get_event_loop().create_task(self.getAudioFilePath())
# asyncio.get_event_loop().call_soon_threadsafe(self.getAudioFilePath) # asyncio.get_event_loop().call_soon_threadsafe(self.getAudioFilePath)
self.logger.warn(f"started {name}") self.logger.warn(f"started {name}")
@ -1336,12 +1336,12 @@ class Story(object):
def setVariableValue(self, name, value, store=True): def setVariableValue(self, name, value, store=True):
if name not in self.variables: if name not in self.variables:
self.logger.warn(f"Set variable that is not needed in the story: {name}") self.logger.warn(f"Set variable that is not needed in the story: {name}")
else:
if self.variableValues[name] == value: if name in self.variableValues and self.variableValues[name] == value:
self.logger.debug(f"Skip double setting of variable {name} to {value}") self.logger.debug(f"Skip double setting of variable {name} to {value}")
return return
else:
self.logger.debug(f"Set variable {name} to {value}") self.logger.debug(f"Set variable {name} to {value}")
self.variableValues[name] = value self.variableValues[name] = value
if store: if store: