Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
wizard: don't crash when unexpected network type is entered, fixes #3561
  • Loading branch information
perexg committed Feb 8, 2016
1 parent d263897 commit 9ff6b9b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/input/mpegts/linuxdvb/linuxdvb_frontend.c
Expand Up @@ -1808,13 +1808,13 @@ linuxdvb_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang
linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)ti;
const char *ntype = htsmsg_get_str(conf, "mpegts_network_type");
mpegts_network_t *mn;
htsmsg_t *nlist;

if (LIST_FIRST(&lfe->mi_mux_active))
return;
mpegts_network_wizard_create(ntype, &nlist, lang);
mn = linuxdvb_frontend_wizard_network(lfe);
if (ntype && (mn == NULL || mn->mn_wizard)) {
htsmsg_t *nlist;
mpegts_network_wizard_create(ntype, &nlist, lang);
if (lfe->lfe_satconf) {
htsmsg_t *conf = htsmsg_create_map();
htsmsg_t *elems = htsmsg_create_list();
Expand All @@ -1837,6 +1837,8 @@ linuxdvb_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang
if (linuxdvb_frontend_wizard_network(lfe))
mpegts_input_set_enabled((mpegts_input_t *)lfe, 1);
linuxdvb_adapter_save(lfe->lfe_adapter);
} else {
htsmsg_destroy(nlist);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/input/mpegts/mpegts_network.c
Expand Up @@ -543,7 +543,7 @@ mpegts_network_wizard_create

/* only one network per type */
LIST_FOREACH(mn, &mpegts_network_all, mn_global_link)
if (mn->mn_id.in_class == mnb->idc)
if (mn->mn_id.in_class == mnb->idc && mn->mn_wizard)
goto found;

conf = htsmsg_create_map();
Expand Down Expand Up @@ -597,6 +597,8 @@ mpegts_network_builder_find
( const char *clazz )
{
mpegts_network_builder_t *mnb;
if (clazz == NULL)
return NULL;
LIST_FOREACH(mnb, &mpegts_network_builders, link) {
if (!strcmp(mnb->idc->ic_class, clazz))
return mnb;
Expand Down
8 changes: 5 additions & 3 deletions src/input/mpegts/satip/satip_frontend.c
Expand Up @@ -1793,14 +1793,14 @@ satip_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang )
satip_frontend_t *lfe = (satip_frontend_t*)ti;
const char *ntype = htsmsg_get_str(conf, "mpegts_network_type");
mpegts_network_t *mn;
htsmsg_t *nlist;

mpegts_network_wizard_create(ntype, &nlist, lang);
mn = satip_frontend_wizard_network(lfe);
if (ntype && lfe->sf_master == 0 && (mn == NULL || mn->mn_wizard)) {
if (nlist && lfe->sf_master == 0 && (mn == NULL || mn->mn_wizard)) {
htsmsg_t *conf = htsmsg_create_map();
htsmsg_t *list = htsmsg_create_list();
htsmsg_t *pos = htsmsg_create_map();
htsmsg_t *nlist;
mpegts_network_wizard_create(ntype, &nlist, lang);
htsmsg_add_bool(pos, "enabled", 1);
htsmsg_add_msg(pos, "networks", nlist);
htsmsg_add_msg(list, NULL, pos);
Expand All @@ -1810,6 +1810,8 @@ satip_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang )
if (satip_frontend_wizard_network(lfe))
mpegts_input_set_enabled((mpegts_input_t *)lfe, 1);
satip_device_save(lfe->sf_device);
} else {
htsmsg_destroy(nlist);
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c
Expand Up @@ -618,17 +618,19 @@ tvhdhomerun_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *la
tvhdhomerun_frontend_t *hfe = (tvhdhomerun_frontend_t*)ti;
const char *ntype = htsmsg_get_str(conf, "mpegts_network_type");
mpegts_network_t *mn;
htsmsg_t *nlist;

mn = tvhdhomerun_frontend_wizard_network(hfe);
mpegts_network_wizard_create(ntype, &nlist, lang);
if (ntype && (mn == NULL || mn->mn_wizard)) {
htsmsg_t *nlist = htsmsg_create_list();
mpegts_network_wizard_create(ntype, &nlist, lang);
htsmsg_add_str(nlist, NULL, ntype);
mpegts_input_set_networks((mpegts_input_t *)hfe, nlist);
htsmsg_destroy(nlist);
if (tvhdhomerun_frontend_wizard_network(hfe))
mpegts_input_set_enabled((mpegts_input_t *)hfe, 1);
tvhdhomerun_device_save(hfe->hf_device);
} else {
htsmsg_destroy(nlist);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/wizard.c
Expand Up @@ -615,7 +615,9 @@ NETWORK_FCN(6)

DESCRIPTION_FCN(network, N_("\
Select network type for detected tuners.\n\
The T means terresterial, C is cable and S is satellite.\
The T means terresterial, C is cable and S is satellite.\n\
If you do not assign a network type to the tuner, the tuner\
will not be used in TVH.\
"))


Expand Down

0 comments on commit 9ff6b9b

Please sign in to comment.