diff --git a/src/apps/powerstatus/PowerStatus.cpp b/src/apps/powerstatus/PowerStatus.cpp index be193ada61..46c785474b 100644 --- a/src/apps/powerstatus/PowerStatus.cpp +++ b/src/apps/powerstatus/PowerStatus.cpp @@ -77,21 +77,17 @@ PowerStatus::ReadyToRun() bool isInstalled = false; bool isDeskbarRunning = true; - PowerStatusDriverInterface* interface; - interface = new ACPIDriverInterface; - if (interface->Connect() != B_OK) { - delete interface; - interface = new APMDriverInterface; - if (interface->Connect() != B_OK) { - BAlert* alert = new BAlert("", + if (ACPIDriverInterface().Connect() != B_OK) { + if (APMDriverInterface().Connect() != B_OK) { + BAlert* alert = new BAlert("", B_TRANSLATE("No supported battery detected. PowerStatus " "cannot be used on your system."), B_TRANSLATE("Too bad!"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->Go(); Quit(); + return; } } - delete interface; { // if the Deskbar is not alive at this point, it might be after having