Handle empty read from file.

Test: run /vendor/bin/dump/dump_power
Bug: 317934817
Change-Id: Ia4453483fdfaba838a1ffb3d38b243dceb9628e7
Signed-off-by: Jenny Ho <hsiufangho@google.com>
This commit is contained in:
Jenny Ho 2023-12-28 11:35:08 +08:00
parent a084844075
commit 1257aa5cdd

View file

@ -374,7 +374,7 @@ void dumpBatteryDefend() {
for (auto &file : files) {
fileLocation = std::string(config[1]) + std::string(file);
if (!android::base::ReadFileToString(fileLocation, &content)) {
if (!android::base::ReadFileToString(fileLocation, &content) || content.empty()) {
content = "\n";
}