Merge "Don't set hidl_string's buffer to nullptr"
diff --git a/automotive/vehicle/2.0/default/common/src/VehicleUtils.cpp b/automotive/vehicle/2.0/default/common/src/VehicleUtils.cpp
index 311cdef..9146fa1 100644
--- a/automotive/vehicle/2.0/default/common/src/VehicleUtils.cpp
+++ b/automotive/vehicle/2.0/default/common/src/VehicleUtils.cpp
@@ -102,10 +102,10 @@
}
void shallowCopyHidlStr(hidl_string* dest, const hidl_string& src) {
- if (!src.empty()) {
+ if (src.empty()) {
+ dest->clear();
+ } else {
dest->setToExternal(src.c_str(), src.size());
- } else if (dest->size() > 0) {
- dest->setToExternal(0, 0);
}
}