diff options
author | jstebbins <[email protected]> | 2014-08-04 15:05:43 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-08-04 15:05:43 +0000 |
commit | 2f27606181aebba7f8a17197a3b40a0a8d47d7ad (patch) | |
tree | a8b5a7d34ceb736a788c46673ef04bd9bb445a46 /gtk | |
parent | a4e56b62d2548030d894614b52eea06a8dca3c8c (diff) |
LinGui: Don't allow adding embedded subtitls when there are none
Fixes a crash when attempting to switch subtitle dialog to embedded
subtitle view.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6266 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/subtitlehandler.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c index f028a1f75..dd4faef4b 100644 --- a/gtk/src/subtitlehandler.c +++ b/gtk/src/subtitlehandler.c @@ -276,7 +276,7 @@ subtitle_add_to_settings(GValue *settings, GValue *subsettings) static void subtitle_set_track_description(GValue *settings, GValue *subsettings) { - char *desc; + char *desc = NULL; if (ghb_settings_get_int(subsettings, "SubtitleSource") == SRTSUB) { @@ -318,13 +318,25 @@ subtitle_set_track_description(GValue *settings, GValue *subsettings) else { subtitle = ghb_get_subtitle_info(title, track); - desc = g_strdup_printf("%d - %s (%s)", track + 1, subtitle->lang, - hb_subsource_name(subtitle->source)); + if (subtitle != NULL) + { + desc = g_strdup_printf("%d - %s (%s)", track + 1, + subtitle->lang, + hb_subsource_name(subtitle->source)); + } } } - ghb_settings_set_string( - subsettings, "SubtitleTrackDescription", desc); + if (desc != NULL) + { + ghb_settings_set_string( + subsettings, "SubtitleTrackDescription", desc); + } + else + { + ghb_settings_set_string( + subsettings, "SubtitleTrackDescription", "Error!"); + } g_free(desc); } @@ -420,6 +432,15 @@ ghb_subtitle_title_change(signal_user_data_t *ud, gboolean show) gtk_widget_set_sensitive(w, show); w = GHB_WIDGET(ud->builder, "subtitle_reset"); gtk_widget_set_sensitive(w, show); + + int title_id, titleindex; + title_id = ghb_settings_get_int(ud->settings, "title"); + const hb_title_t *title = ghb_lookup_title(title_id, &titleindex); + if (title != NULL) + { + w = GHB_WIDGET(ud->builder, "SubtitleSrtDisable"); + gtk_widget_set_sensitive(w, !!hb_list_count(title->list_subtitle)); + } } void |