desklink: Use early return, no functional change.

This commit is contained in:
Michael Lotz 2015-04-05 21:25:09 +02:00
parent 77c35db9a9
commit 5c7707fc34

View File

@ -302,31 +302,32 @@ VolumeControl::MessageReceived(BMessage* msg)
bool isMediaServer = !strcmp(signature, kMediaServerSignature);
bool isAddOnServer = !strcmp(signature, kAddOnServerSignature);
if (!isMediaServer && !isAddOnServer)
break;
if (isMediaServer)
fMediaServerRunning = msg->what == B_SOME_APP_LAUNCHED;
if (isAddOnServer)
fAddOnServerRunning = msg->what == B_SOME_APP_LAUNCHED;
if (isMediaServer || isAddOnServer) {
if (!fMediaServerRunning && !fAddOnServerRunning) {
// No media server around
SetLabel(B_TRANSLATE("No media server running"));
SetEnabled(false);
} else if (fMediaServerRunning && fAddOnServerRunning) {
// HACK!
// quit our now invalid instance of the media roster
// so that before new nodes are created,
// we get a new roster
BMediaRoster* roster = BMediaRoster::CurrentRoster();
if (roster != NULL) {
roster->Lock();
roster->Quit();
}
BMessage reconnect(kMsgReconnectVolume);
BMessageRunner::StartSending(this, &reconnect, 1000000LL, 1);
fConnectRetries = 3;
if (!fMediaServerRunning && !fAddOnServerRunning) {
// No media server around
SetLabel(B_TRANSLATE("No media server running"));
SetEnabled(false);
} else if (fMediaServerRunning && fAddOnServerRunning) {
// HACK!
// quit our now invalid instance of the media roster
// so that before new nodes are created,
// we get a new roster
BMediaRoster* roster = BMediaRoster::CurrentRoster();
if (roster != NULL) {
roster->Lock();
roster->Quit();
}
BMessage reconnect(kMsgReconnectVolume);
BMessageRunner::StartSending(this, &reconnect, 1000000LL, 1);
fConnectRetries = 3;
}
break;
}