summaryrefslogtreecommitdiff
path: root/music
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-09-08 12:22:47 +0000
committerDarkvater <Darkvater@openttd.org>2005-09-08 12:22:47 +0000
commit91c217867f8a98441055831c2d092115f45e5860 (patch)
tree5dd761d2f5bc5fa38a34da674e73bcaa3ab72ec7 /music
parent6145b99c22ba5dfaced8aa51776c855f765a9b1a (diff)
downloadopenttd-91c217867f8a98441055831c2d092115f45e5860.tar.xz
(svn r2922) Fix crash with directmusic if no music files could be found to play
Diffstat (limited to 'music')
-rw-r--r--music/dmusic.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/music/dmusic.cpp b/music/dmusic.cpp
index 28a43803f..b93acde19 100644
--- a/music/dmusic.cpp
+++ b/music/dmusic.cpp
@@ -115,18 +115,24 @@ static void DMusicMidiStop(void)
{
seeking = false;
- performance->Stop(NULL, NULL, 0, 0);
+ if (performance != NULL) performance->Stop(NULL, NULL, 0, 0);
- segment->SetParam(GUID_Unload, -1, 0, 0, performance);
- segment->Release();
- segment = NULL;
+ if (segment != NULL) {
+ segment->SetParam(GUID_Unload, -1, 0, 0, performance);
+ segment->Release();
+ segment = NULL;
+ }
- performance->CloseDown();
- performance->Release();
- performance = NULL;
+ if (performance != NULL) {
+ performance->CloseDown();
+ performance->Release();
+ performance = NULL;
+ }
- loader->Release();
- loader = NULL;
+ if (loader != NULL) {
+ loader->Release();
+ loader = NULL;
+ }
proc.CoUninitialize();
}