Only convert valid SharedMemInfo
This CL avoids passing nullptr to underlying HAL and cause
SEGFAULT.
Bug: 37589989
Test: compiles and VTS passing
Change-Id: Ic44409e64466e54a3a3027721897c0755ba34fc7
diff --git a/sensors/1.0/default/convert.cpp b/sensors/1.0/default/convert.cpp
index 3d859ec..2908737 100644
--- a/sensors/1.0/default/convert.cpp
+++ b/sensors/1.0/default/convert.cpp
@@ -374,6 +374,10 @@
return false;
}
+ if (memIn.memoryHandle == nullptr) {
+ return false;
+ }
+
memOut->size = memIn.size;
memOut->handle = memIn.memoryHandle;
return true;