PowerStatus: Abort cleanly after battery not detected.

fixes #18113

Change-Id: Id346807cea95fc4814f261cc0203fa6f8e4ee132
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5873
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Samuel D. Crow
2022-12-19 18:42:16 +00:00
committed by waddlesplash
parent d9f90ce7f3
commit 3e4b839bbf
+4 -8
View File
@@ -77,21 +77,17 @@ PowerStatus::ReadyToRun()
bool isInstalled = false; bool isInstalled = false;
bool isDeskbarRunning = true; bool isDeskbarRunning = true;
PowerStatusDriverInterface* interface; if (ACPIDriverInterface().Connect() != B_OK) {
interface = new ACPIDriverInterface; if (APMDriverInterface().Connect() != B_OK) {
if (interface->Connect() != B_OK) { BAlert* alert = new BAlert("",
delete interface;
interface = new APMDriverInterface;
if (interface->Connect() != B_OK) {
BAlert* alert = new BAlert("",
B_TRANSLATE("No supported battery detected. PowerStatus " B_TRANSLATE("No supported battery detected. PowerStatus "
"cannot be used on your system."), B_TRANSLATE("Too bad!"), "cannot be used on your system."), B_TRANSLATE("Too bad!"),
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->Go(); alert->Go();
Quit(); Quit();
return;
} }
} }
delete interface;
{ {
// if the Deskbar is not alive at this point, it might be after having // if the Deskbar is not alive at this point, it might be after having