summaryrefslogtreecommitdiffstats
path: root/sensors
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2017-02-28 17:54:53 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-02-28 17:54:54 +0000
commit06635d1537d8037d7173cc9a36a3fad48561d940 (patch)
tree2b281ade551f2592473a781c16a17301044c37b0 /sensors
parentf71070d4a6f43f7fd4446657d161a31c419371ab (diff)
parent8dbdf39b9ac7d82c8f5802863b461734005798dd (diff)
downloadplatform_hardware_interfaces-06635d1537d8037d7173cc9a36a3fad48561d940.tar.gz
platform_hardware_interfaces-06635d1537d8037d7173cc9a36a3fad48561d940.tar.bz2
platform_hardware_interfaces-06635d1537d8037d7173cc9a36a3fad48561d940.zip
Merge "Revert "Revert "Protect against null strings in hal wrapper implementation."""
Diffstat (limited to 'sensors')
-rw-r--r--sensors/1.0/default/convert.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/sensors/1.0/default/convert.cpp b/sensors/1.0/default/convert.cpp
index 306d3a3bc2..748a9639c6 100644
--- a/sensors/1.0/default/convert.cpp
+++ b/sensors/1.0/default/convert.cpp
@@ -25,8 +25,8 @@ namespace V1_0 {
namespace implementation {
void convertFromSensor(const sensor_t &src, SensorInfo *dst) {
- dst->name = src.name;
- dst->vendor = src.vendor;
+ dst->name = src.name == nullptr ? "" : src.name;
+ dst->vendor = src.vendor == nullptr ? "" : src.vendor;
dst->version = src.version;
dst->sensorHandle = src.handle;
dst->type = (SensorType)src.type;
@@ -36,8 +36,8 @@ void convertFromSensor(const sensor_t &src, SensorInfo *dst) {
dst->minDelay = src.minDelay;
dst->fifoReservedEventCount = src.fifoReservedEventCount;
dst->fifoMaxEventCount = src.fifoMaxEventCount;
- dst->typeAsString = src.stringType;
- dst->requiredPermission = src.requiredPermission;
+ dst->typeAsString = src.stringType == nullptr ? "" : src.stringType;
+ dst->requiredPermission = src.requiredPermission == nullptr ? "" : src.requiredPermission;
dst->maxDelay = src.maxDelay;
dst->flags = src.flags;
}