diff options
author | John Stebbins <[email protected]> | 2016-03-27 10:17:54 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-03-27 10:17:54 -0700 |
commit | 982883bafae3df039a25f137bfb2084ebb67150d (patch) | |
tree | 91ba6a1958d12f96d6d06f3b7f519121c628dbaf /gtk | |
parent | 6685f23b8aeb8afd98103500a8cfebc0c3b9c1ea (diff) |
LinGui: fix crash when no preset selected and scan new source
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/presets.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/gtk/src/presets.c b/gtk/src/presets.c index 167356690..dd1676b1f 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -330,13 +330,13 @@ ghb_preset_to_settings(GhbValue *settings, GhbValue *preset) } const gchar *mode = ghb_dict_get_string(settings, "VideoFramerateMode"); - if (strcmp(mode, "cfr") == 0) + if (mode != NULL && strcmp(mode, "cfr") == 0) { ghb_dict_set_bool(settings, "VideoFramerateCFR", TRUE); ghb_dict_set_bool(settings, "VideoFrameratePFR", FALSE); ghb_dict_set_bool(settings, "VideoFramerateVFR", FALSE); } - else if (strcmp(mode, "pfr") == 0) + else if (mode != NULL && strcmp(mode, "pfr") == 0) { ghb_dict_set_bool(settings, "VideoFramerateCFR", FALSE); ghb_dict_set_bool(settings, "VideoFrameratePFR", TRUE); @@ -388,30 +388,33 @@ ghb_preset_to_settings(GhbValue *settings, GhbValue *preset) char *tok; videoTune = g_strdup(ghb_dict_get_string(settings, "VideoTune")); - tok = strtok_r(videoTune, ",./-+", &saveptr); - ghb_dict_set_bool(settings, "x264FastDecode", FALSE); - ghb_dict_set_bool(settings, "x264ZeroLatency", FALSE); - while (tok != NULL) + if (videoTune != NULL) { - if (!strcasecmp(tok, "fastdecode")) + tok = strtok_r(videoTune, ",./-+", &saveptr); + ghb_dict_set_bool(settings, "x264FastDecode", FALSE); + ghb_dict_set_bool(settings, "x264ZeroLatency", FALSE); + while (tok != NULL) { - ghb_dict_set_bool(settings, "x264FastDecode", TRUE); - } - else if (!strcasecmp(tok, "zerolatency")) - { - ghb_dict_set_bool(settings, "x264ZeroLatency", TRUE); - } - else if (tune == NULL) - { - tune = g_strdup(tok); - } - else - { - ghb_log("Superfluous tunes! %s", tok); + if (!strcasecmp(tok, "fastdecode")) + { + ghb_dict_set_bool(settings, "x264FastDecode", TRUE); + } + else if (!strcasecmp(tok, "zerolatency")) + { + ghb_dict_set_bool(settings, "x264ZeroLatency", TRUE); + } + else if (tune == NULL) + { + tune = g_strdup(tok); + } + else + { + ghb_log("Superfluous tunes! %s", tok); + } + tok = strtok_r(NULL, ",./-+", &saveptr); } - tok = strtok_r(NULL, ",./-+", &saveptr); + g_free(videoTune); } - g_free(videoTune); if (tune != NULL) { ghb_dict_set_string(settings, "VideoTune", tune); |