Fix IllegalArgumentException (#19662)

Both driveState and chargeState can be null, as indicated by earlier usage of these fields.
Signed-off-by: ivan <ivan@caffeinated-consulting.com>
This commit is contained in:
iodb
2025-11-18 10:25:42 +01:00
committed by GitHub
parent 66049364fc
commit 4963fc3d62
@@ -951,10 +951,15 @@ public class TeslaVehicleHandler extends BaseThingHandler {
Set<Map.Entry<String, JsonElement>> entrySet = new HashSet<>();
entrySet.addAll(gson.toJsonTree(driveState, DriveState.class).getAsJsonObject().entrySet());
if (driveState != null) {
entrySet.addAll(gson.toJsonTree(driveState, DriveState.class).getAsJsonObject().entrySet());
}
entrySet.addAll(gson.toJsonTree(guiState, GUIState.class).getAsJsonObject().entrySet());
entrySet.addAll(gson.toJsonTree(vehicleState, VehicleState.class).getAsJsonObject().entrySet());
entrySet.addAll(gson.toJsonTree(chargeState, ChargeState.class).getAsJsonObject().entrySet());
if (chargeState != null) {
entrySet.addAll(
gson.toJsonTree(chargeState, ChargeState.class).getAsJsonObject().entrySet());
}
entrySet.addAll(gson.toJsonTree(climateState, ClimateState.class).getAsJsonObject().entrySet());
entrySet.addAll(
gson.toJsonTree(softwareUpdate, SoftwareUpdate.class).getAsJsonObject().entrySet());