Handle empty read from file.

Test: run /vendor/bin/dump/dump_power
Bug: 312681873
Change-Id: I8c49cf7f0048190f02d35d50984abca361d517f1
This commit is contained in:
Florian Mayer 2023-11-22 11:24:27 +00:00
parent 09160b77ca
commit 251d00eb0e

View file

@ -362,7 +362,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";
}