phrack / ShootOFF-legacy

An open source framework to enhance laser dry fire training.
BSD 4-Clause "Original" or "Old" License
30 stars 17 forks source link

RandomShoot crashes if you have subtarget tags on regions, but the region you shot doesn't have a subtarget tag #8

Closed phrack closed 11 years ago

phrack commented 11 years ago

Exception in Tkinter callback Traceback (most recent call last): File "C:\Python27\lib\lib-tk\Tkinter.py", line 1470, in call return self.func(_args) File "C:\Python27\lib\lib-tk\Tkinter.py", line 531, in callit func(_args) File "shootoff.py", line 118, in detect_shots self.process_hit(new_shot) File "shootoff.py", line 162, in process_hit self._loaded_training.hit_listener(region, tags) File "training_protocols\random_shootinit.py", line 65, in hit_listener if tags["subtarget"] == self._subtarget_chain[self._subtarget_index]: KeyError: 'subtarget'

phrack commented 11 years ago

Fixed. It now checks to make sure the region has a subtarge key before reading it.