From aab3453965f616f4fe5b49aa2d63c24fcb8054c6 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 12 Jun 2013 15:57:38 -0700 Subject: [PATCH] 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 --- services/jni/com_android_server_BatteryService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/jni/com_android_server_BatteryService.cpp b/services/jni/com_android_server_BatteryService.cpp index 485c289e68dda..433950d72f7a9 100644 --- a/services/jni/com_android_server_BatteryService.cpp +++ b/services/jni/com_android_server_BatteryService.cpp @@ -144,7 +144,7 @@ static jint getBatteryHealth(const char* status) 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) {