Merge "DO NOT MERGE: libcameraservice: Fix nullptr crash when no client." into mnc-dr-dev
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 2bb282f..3deb396 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -315,8 +315,10 @@
             clientToDisconnect = removeClientLocked(id);
 
             // Notify the client of disconnection
-            clientToDisconnect->notifyError(ICameraDeviceCallbacks::ERROR_CAMERA_DISCONNECTED,
-                    CaptureResultExtras{});
+            if (clientToDisconnect != nullptr) {
+                clientToDisconnect->notifyError(ICameraDeviceCallbacks::ERROR_CAMERA_DISCONNECTED,
+                        CaptureResultExtras{});
+            }
         }
 
         ALOGI("%s: Client for camera ID %s evicted due to device status change from HAL",