From 0974aaee154a6395e1a9d7854cde37c68cc84a6a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 6 May 2011 16:52:26 +0000 Subject: [PATCH] add (slightly overly) cautious checks of battery info to avoid NULL segfault... acpi can be flakey at times git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41343 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/powerstatus/ExtendedInfoWindow.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/apps/powerstatus/ExtendedInfoWindow.cpp b/src/apps/powerstatus/ExtendedInfoWindow.cpp index 6335dd3e12..2f693e05fe 100644 --- a/src/apps/powerstatus/ExtendedInfoWindow.cpp +++ b/src/apps/powerstatus/ExtendedInfoWindow.cpp @@ -137,10 +137,14 @@ BatteryInfoView::_FillStringList() else if (fBatteryInfo.state & BATTERY_DISCHARGING) fontString->string = B_TRANSLATE("Battery discharging"); else if (fBatteryInfo.state & BATTERY_CRITICAL_STATE - && !strcmp(fBatteryExtendedInfo.model_number, "") - && !strcmp(fBatteryExtendedInfo.serial_number, "") - && !strcmp(fBatteryExtendedInfo.type, "") - && !strcmp(fBatteryExtendedInfo.oem_info, "")) + && (!fBatteryExtendedInfo.model_number + || !strlen(fBatteryExtendedInfo.model_number)) + && (!fBatteryExtendedInfo.serial_number + || !strlen(fBatteryExtendedInfo.serial_number)) + && (!fBatteryExtendedInfo.type + || !strlen(fBatteryExtendedInfo.type)) + && (!fBatteryExtendedInfo.oem_info + || !strlen(fBatteryExtendedInfo.oem_info))) fontString->string = B_TRANSLATE("Empty battery slot"); else if (fBatteryInfo.state & BATTERY_CRITICAL_STATE) fontString->string = B_TRANSLATE("Damaged battery");