summaryrefslogtreecommitdiff
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
commit73662f2fcbd60e0f67d840f9985241f1469a1bfe (patch)
tree5dd761d2f5bc5fa38a34da674e73bcaa3ab72ec7
parent991d5c623467ee13c0f3df90eaa2d5127a4d5be9 (diff)
downloadopenttd-73662f2fcbd60e0f67d840f9985241f1469a1bfe.tar.xz
(svn r2922) Fix crash with directmusic if no music files could be found to play
-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();
}