From 629d7023da9b06ede89fa83632ab22aa8631e41f Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 13 Aug 2009 22:52:45 +0000 Subject: [PATCH] Fix crash when event format is not specified Patch by Andrew Savchenko . git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29514 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libass/ass.c b/libass/ass.c index 822f1e03f8..370063aacf 100644 --- a/libass/ass.c +++ b/libass/ass.c @@ -270,8 +270,15 @@ static int process_event_tail(ass_track_t* track, ass_event_t* event, char* str, int i; ass_event_t* target = event; - char* format = strdup(track->event_format); - char* q = format; // format scanning pointer + char* format; + char* q; // format scanning pointer + + if (!track->event_format) { + track->event_format = strdup("Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"); + mp_msg(MSGT_ASS, MSGL_V, "Event format is broken, reseting to defaults.\n"); + } + + q = format = strdup(track->event_format); if (track->n_styles == 0) { // add "Default" style to the end