fix no car

This commit is contained in:
Florian Bezannier
2021-05-17 20:32:28 +02:00
parent fd320a64a6
commit 06d7c84e20
+2 -2
View File
@@ -132,11 +132,11 @@ if len(res) == 0:
for vehicle in res_dict["vehicles"]:
car = psacc.vehicles_list.get_car_by_vin(vehicle["vin"])
if "short_label" in vehicle and car.label == "unknown":
if "short_label" in vehicle and car is not None and car.label == "unknown":
car.label = vehicle["short_label"].split(" ")[-1] # remove new, nouvelle, neu word....
car.set_energy_capacity()
else:
print("Warning: Can't get car model please check cars.json")
print("Warning: Can't get car model please check cars.json %s", vehicle)
psacc.vehicles_list.save_cars()