changeset 29472:ce53e67e8633

Fix crash when event format is not specified Patch by Andrew Savchenko <bircoph@gmail.com>.
author greg
date Thu, 13 Aug 2009 22:52:45 +0000
parents 7dd86fa7fcad
children 6bab02cf6a31
files libass/ass.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass.c	Thu Aug 13 21:54:08 2009 +0000
+++ b/libass/ass.c	Thu Aug 13 22:52:45 2009 +0000
@@ -270,8 +270,15 @@
 	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