shithub: choc

Download patch

ref: e7262d2a8859501152ef22bc7cb9dcc26b05c402
parent: ca065a06caac9ba5fab3eb8b1f49d529755506db
author: Simon Howard <[email protected]>
date: Sat Aug 29 16:12:49 EDT 2009

Fix crash when specifying an invalid filename.

Subversion-branch: /branches/opl-branch
Subversion-revision: 1634

--- a/opl/examples/droplay.c
+++ b/opl/examples/droplay.c
@@ -183,6 +183,12 @@
 
     timer_data.fstream = fopen(filename, "rb");
 
+    if (timer_data.fstream == NULL)
+    {
+        fprintf(stderr, "Failed to open %s\n", filename);
+        exit(-1);
+    }
+
     if (fread(buf, 1, 8, timer_data.fstream) < 8)
     {
         fprintf(stderr, "failed to read raw OPL header\n");
@@ -226,7 +232,6 @@
 
     Init();
     ClearAllRegs();
-    SDL_Delay(1000);
 
     PlayFile(argv[1]);