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
This commit is contained in:
Alexander von Gluck IV 2011-05-06 16:52:26 +00:00
parent d1baedd428
commit 0974aaee15

View File

@ -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");