File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,13 @@ async def async_get_charges(self, charge_point_id: int) -> any:
131131 headers = {"authorization" : f"Bearer { access_token } " },
132132 )
133133
134- return sorted (response ["data" ], key = lambda charge : - charge ["id" ])
134+ charges = response .get ("data" )
135+
136+ if charges is None :
137+ _LOGGER .warning ("No charges found in response!" )
138+ charges = []
139+
140+ return sorted (charges , key = lambda charge : - charge ["id" ])
135141
136142 async def async_start_charge (self , charge_point_id : int ) -> any :
137143 """Start a charge."""
@@ -177,7 +183,13 @@ async def async_get_wallet_transactions(self) -> any:
177183 headers = {"authorization" : f"Bearer { access_token } " },
178184 )
179185
180- return sorted (response ["data" ], key = lambda transaction : - transaction ["id" ])
186+ transactions = response .get ("data" )
187+
188+ if transactions is None :
189+ _LOGGER .warning ("No transactions found in response!" )
190+ transactions = []
191+
192+ return sorted (transactions , key = lambda transaction : - transaction ["id" ])
181193
182194 async def async_get_access_token (self ) -> str :
183195 """Get access token."""
You can’t perform that action at this time.
0 commit comments