Constructing a std::string from nullptr is undefined behavior and
caused an exception after setting std=c++17 flag in GCC
(no exception was thrown when compiling with std=c++14).
This commit removes the UB.
The problem caused MediaControllerServerInfo_iconURI_attribute test
from tct-mediacontroller-tizen-tests failures.
[Verification] auto tct-mediacontroller-tizen-tests
1. with std=c++14: 100% pass rate
2. with std=c++17: 100% pass rate
Change-Id: I4857e3d9f8ba2940b50223e89ff952625ba37b3c
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
return PlatformResult(ErrorCode::UNKNOWN_ERR);
}
- *icon_uri = nullptr;
if (nullptr != icon_uri_str) {
*icon_uri = std::string(icon_uri_str);
+ } else {
+ *icon_uri = std::string{};
}
return PlatformResult(ErrorCode::NO_ERROR);