summaryrefslogtreecommitdiff
path: root/opl/examples
diff options
context:
space:
mode:
authorSimon Howard2009-08-29 20:12:49 +0000
committerSimon Howard2009-08-29 20:12:49 +0000
commite7262d2a8859501152ef22bc7cb9dcc26b05c402 (patch)
treeea2469cb117ef4de7c4f99f43a3d5d6e7050677c /opl/examples
parentca065a06caac9ba5fab3eb8b1f49d529755506db (diff)
downloadchocolate-doom-e7262d2a8859501152ef22bc7cb9dcc26b05c402.tar.gz
chocolate-doom-e7262d2a8859501152ef22bc7cb9dcc26b05c402.tar.bz2
chocolate-doom-e7262d2a8859501152ef22bc7cb9dcc26b05c402.zip
Fix crash when specifying an invalid filename.
Subversion-branch: /branches/opl-branch Subversion-revision: 1634
Diffstat (limited to 'opl/examples')
-rw-r--r--opl/examples/droplay.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/opl/examples/droplay.c b/opl/examples/droplay.c
index b1656815..4c2fc2f8 100644
--- a/opl/examples/droplay.c
+++ b/opl/examples/droplay.c
@@ -183,6 +183,12 @@ void PlayFile(char *filename)
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 @@ int main(int argc, char *argv[])
Init();
ClearAllRegs();
- SDL_Delay(1000);
PlayFile(argv[1]);