]> git.basschouten.com Git - openhab-addons.git/commitdiff
[tesla] Prevent NPE (#10872)
authorKai Kreuzer <kai@openhab.org>
Tue, 15 Jun 2021 21:47:47 +0000 (23:47 +0200)
committerGitHub <noreply@github.com>
Tue, 15 Jun 2021 21:47:47 +0000 (23:47 +0200)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java

index 44d55912531296474b662e70f0a2f6aef2610edf..b3f999c57ae84d71d10aadd5441709a5532d6f7b 100644 (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);