]> granicus.if.org Git - libass/commitdiff
Test program: check track initialization
authorGrigori Goronzy <goronzy@64pc31.informatik.uni-luebeck.de>
Thu, 2 Jul 2009 14:43:24 +0000 (16:43 +0200)
committerGrigori Goronzy <greg@blackbox>
Mon, 6 Jul 2009 23:39:44 +0000 (01:39 +0200)
Stop in case the track initialization fails.  This fixes a crash.

test/test.cpp

index 4b39110d0913ec7cda15d1453ca02bae5477045f..816d7791c31b703bb7873f1307a0224816980cf0 100644 (file)
@@ -147,6 +147,10 @@ int main(int argc, char* argv[]) {
 
   init(frame_w, frame_h);
   ass_track_t* track = ass_read_file(ass_library, subfile, NULL);
+  if (!track) {
+    printf("track init failed!\n");
+    return 1;
+  }
   
   ass_image_t* img = ass_render_frame(ass_renderer, track, (int)(tm * 1000), NULL);
   image_t* frame = gen_image(frame_w, frame_h);