Fix crash when propinfo is null (#1544)

This commit is contained in:
LoveSy 2022-01-16 20:36:59 +08:00 committed by GitHub
parent 8ddbe37d35
commit efe6ed1288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -268,12 +268,14 @@ void Logcat::EnsureLogWatchDog() {
SetStrProp("ctl.start", "logd-reinit"); SetStrProp("ctl.start", "logd-reinit");
} }
const auto *pi = __system_property_find(kLogdTagProp.data()); const auto *pi = __system_property_find(kLogdTagProp.data());
uint32_t serial; uint32_t serial = 0;
__system_property_read_callback(pi, [](auto *c, auto, auto, auto s) { if (pi != nullptr) {
*reinterpret_cast<uint32_t *>(c) = s; __system_property_read_callback(pi, [](auto *c, auto, auto, auto s) {
}, &serial); *reinterpret_cast<uint32_t *>(c) = s;
}, &serial);
}
if (!__system_property_wait(pi, serial, &serial, nullptr)) break; if (!__system_property_wait(pi, serial, &serial, nullptr)) break;
Log("\nResetting log settings\n"); if (pi != nullptr) Log("\nResetting log settings\n");
} }
}).detach(); }).detach();
} }