summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();
}