commit | 04c699218a11ecd1a11b8a9a6b02d6a4e76c6b4a | [log] [tgz] |
---|---|---|
author | Jeff Brown <jeffbrown@google.com> | Wed Jun 12 15:57:38 2013 -0700 |
committer | Jeff Brown <jeffbrown@google.com> | Wed Jun 12 15:57:38 2013 -0700 |
tree | 7a3c4da49c7d15248fe2f49ae393b05a3cb34b97 | |
parent | 76b76666f5c28751db6ed8791fd54ec430d4361a [diff] |
Fix logspam when battery sysfs file not available. This was a regression caused by a recent change to use String8 instead of char*. We missed the implicit null check here. Bug: 9377604 Change-Id: I7eff138096622c47b5d45678010373dc82138384
diff --git a/services/jni/com_android_server_BatteryService.cpp b/services/jni/com_android_server_BatteryService.cpp index 485c289..433950d 100644 --- a/services/jni/com_android_server_BatteryService.cpp +++ b/services/jni/com_android_server_BatteryService.cpp
@@ -144,7 +144,7 @@ static int readFromFile(const String8& path, char* buf, size_t size) { - if (!path) + if (path.isEmpty()) return -1; int fd = open(path.string(), O_RDONLY, 0); if (fd == -1) {