Prevent segmentation fault when resetprop is unsupported

This commit is contained in:
topjohnwu 2019-02-03 09:48:57 -05:00
parent 1e94f0a094
commit 72270825c1

View File

@ -129,7 +129,7 @@ int prop_exist(const char *name) {
// Get prop by name, return string // Get prop by name, return string
string getprop(const char *name, bool persist) { string getprop(const char *name, bool persist) {
if (!check_legal_property_name(name) || init_resetprop()) if (!check_legal_property_name(name) || init_resetprop())
return nullptr; return string();
const prop_info *pi = __system_property_find(name); const prop_info *pi = __system_property_find(name);
if (pi == nullptr) { if (pi == nullptr) {
if (persist && strncmp(name, "persist.", 8) == 0) { if (persist && strncmp(name, "persist.", 8) == 0) {