]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Don't crash the wizard if tvh has no inputs
authorDavid Kalnischkies <david@kalnischkies.de>
Sat, 22 Oct 2022 11:17:50 +0000 (13:17 +0200)
committerFlole998 <Flole998@users.noreply.github.com>
Mon, 21 Nov 2022 01:33:44 +0000 (02:33 +0100)
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.

src/wizard.c

index 1f7db17b5c0c799f940607163175278cf8a9aadd..a18099a26beb3b7c721b4858c4657da4c7aed37b 100644 (file)
@@ -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)