File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,13 +141,16 @@ async def getEmergencyTypes(self):
141141 data = await self .director .getItemInfo (self .item_id )
142142 jsonDictionary = json .loads (data )
143143
144- if jsonDictionary [0 ]["capabilities" ]["has_fire" ]:
144+ capabilities = (
145+ jsonDictionary [0 ].get ("capabilities" , {}) if jsonDictionary else {}
146+ )
147+ if capabilities .get ("has_fire" ):
145148 types_list .append ("Fire" )
146- if jsonDictionary [ 0 ][ " capabilities" ][ " has_medical"] :
149+ if capabilities . get ( " has_medical") :
147150 types_list .append ("Medical" )
148- if jsonDictionary [ 0 ][ " capabilities" ][ " has_panic"] :
151+ if capabilities . get ( " has_panic") :
149152 types_list .append ("Panic" )
150- if jsonDictionary [ 0 ][ " capabilities" ][ " has_police"] :
153+ if capabilities . get ( " has_police") :
151154 types_list .append ("Police" )
152155
153156 return types_list
You can’t perform that action at this time.
0 commit comments