[tesla] Prevent NPE (#10872)

Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer
2021-06-15 23:47:47 +02:00
committed by GitHub
parent 54d88a84ce
commit f506ec299b

View File

@@ -560,7 +560,9 @@ public class TeslaVehicleHandler extends BaseThingHandler {
}
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
eventClient.close();
if (eventClient != null) {
eventClient.close();
}
} else if ((System.currentTimeMillis() - apiIntervalTimestamp) > 1000
* TeslaAccountHandler.API_ERROR_INTERVAL_SECONDS) {
logger.trace("Resetting the error counter. ({} errors in the last interval)", apiIntervalErrors);