diff --git a/qtgui/instrument.py b/qtgui/instrument.py index 8ca94c4..c298e7b 100644 --- a/qtgui/instrument.py +++ b/qtgui/instrument.py @@ -309,8 +309,9 @@ class InstrumentTreeController(object): def react_instrumentStatusChanged(self, instrumentStatus:dict): self.parentMainWindow.qtApp.restoreOverrideCursor() #Sometimes the instrument was loaded with a cursor animation - gi = self.guiInstruments[instrumentStatus["idKey"]] - gi.updateStatus(instrumentStatus) + if instrumentStatus["idKey"] in self.guiInstruments: + gi = self.guiInstruments[instrumentStatus["idKey"]] + gi.updateStatus(instrumentStatus) self._adjustColumnSize() #We also cache the last status, as we cache the initial data. This way we can delete and recreate TreeItems without requesting new status data from the engine @@ -327,8 +328,9 @@ class InstrumentTreeController(object): def react_instrumentMidiNoteOnActivity(self, idKey:tuple, pitch:int, velocity:int): #First figure out which instrument has activity - gi = self.guiInstruments[idKey] - gi.activity() #We only do a quick flash here. No need for velocity, pitch or note-off + if idKey in self.guiInstruments: + gi = self.guiInstruments[idKey] + gi.activity() #We only do a quick flash here. No need for velocity, pitch or note-off def contextMenu(self, qpoint): #strange that this is not an event but a qpoint