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
Merged-In: Ic44409e64466e54a3a3027721897c0755ba34fc7
This commit is contained in:
Peng Xu
2017-05-04 17:14:42 -07:00
parent 44256a7fbd
commit ce6e742eb6

View File

@@ -376,6 +376,10 @@ bool convertFromSharedMemInfo(const SharedMemInfo& memIn, sensors_direct_mem_t *
return false;
}
if (memIn.memoryHandle == nullptr) {
return false;
}
memOut->size = memIn.size;
memOut->handle = memIn.memoryHandle;
return true;