From c278fca4e9f034af70d100811dff4d191ab4f757 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 13 Jan 2013 17:42:47 +0100 Subject: [PATCH] neutrino: tell the user if no frontend is found even though there is not much left to do if no frontend is present, at least the user can be informed about that fact before crashing :-) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/aa098a7701eebcc64940273d8e0a0b6a6e231b5f Author: Stefan Seyfried Date: 2013-01-13 (Sun, 13 Jan 2013) ------------------ This commit was generated by Migit --- src/neutrino.cpp | 8 +++++++- src/zapit/src/zapit.cpp | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 2335451f7..e2a782688 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1840,7 +1840,7 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms ZapStart_arg.volume = g_settings.current_volume; /* create decoders, read channels */ - CZapit::getInstance()->Start(&ZapStart_arg); + bool zapit_init = CZapit::getInstance()->Start(&ZapStart_arg); fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms() - starttime); // init audio settings @@ -1862,6 +1862,12 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms g_RCInput = new CRCInput(); + /* later on, we'll crash anyway, so tell about it. */ + if (! zapit_init) + ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, + "Zapit initialization failed.\nThis is a fatal error, sorry.", + CMessageBox::mbrBack, CMessageBox::mbBack); + InitZapitClient(); g_Zapit->setStandby(false); diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index ea4479ec1..d89112ba0 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -2140,6 +2140,10 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg) CFEManager::getInstance()->Init(); live_fe = CFEManager::getInstance()->getFE(0); + + if (live_fe == NULL) /* no frontend found? */ + return false; + /* load configuration or set defaults if no configuration file exists */ video_mode = ZapStart_arg->video_mode; current_volume = ZapStart_arg->volume;