From: David Kalnischkies Date: Sat, 22 Oct 2022 11:17:50 +0000 (+0200) Subject: Don't crash the wizard if tvh has no inputs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8df3e2d55240d4b21ec5bdf20cc89b4a5e73b2;p=thirdparty%2Ftvheadend.git Don't crash the wizard if tvh has no inputs If you have e.g. all but dvb disabled and forgot to plug in your usb adapter the wizard would crash upon you as no inputs are defined and the looping assumes there is at least one. Ideally a message should be shown to indicate that you need inputs, but a wizard displaying a mostly empty page is far better than a crash to discover your mistake. --- diff --git a/src/wizard.c b/src/wizard.c index 1f7db17b5..a18099a26 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -686,6 +686,9 @@ wizard_page_t *wizard_network(const char *lang) for (idx = 0; idx < ARRAY_SIZE(props); idx++) w->props[idx] = props[idx]; + if (!tvh_inputs.lh_first) + return page; + for (ti = LIST_LAST(tvh_input_t, &tvh_inputs, ti_link); ti; ti = LIST_PREV(ti, tvh_input_t, &tvh_inputs, ti_link)) { if (ti->ti_wizard_get == NULL)