Camera: Don't crash when the device has no vendor tags.
Turns out copying from null pointers crashes things.
Bug: 27466842
Change-Id: I294f03614eec8c488c016469549464065821a7e7
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 7446c3e..af8fc74 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -658,8 +658,10 @@
ALOGE("%s: camera hardware module doesn't exist", __FUNCTION__);
return STATUS_ERROR(ERROR_DISCONNECTED, "Camera subsystem not available");
}
-
- *desc = *(VendorTagDescriptor::getGlobalVendorTagDescriptor().get());
+ sp<VendorTagDescriptor> globalDescriptor = VendorTagDescriptor::getGlobalVendorTagDescriptor();
+ if (globalDescriptor != nullptr) {
+ *desc = *(globalDescriptor.get());
+ }
return Status::ok();
}