(svn r2922) Fix crash with directmusic if no music files could be found to play
authorDarkvater
Thu, 08 Sep 2005 12:22:47 +0000
changeset 2396 3c03cb7e81bb
parent 2395 d1629f64d157
child 2397 a73a9df21073
(svn r2922) Fix crash with directmusic if no music files could be found to play
music/dmusic.cpp
--- a/music/dmusic.cpp	Wed Sep 07 15:10:11 2005 +0000
+++ b/music/dmusic.cpp	Thu Sep 08 12:22:47 2005 +0000
@@ -115,18 +115,24 @@
 {
 	seeking = false;
 
-	performance->Stop(NULL, NULL, 0, 0);
-
-	segment->SetParam(GUID_Unload, -1, 0, 0, performance);
-	segment->Release();
-	segment = NULL;
+	if (performance != NULL) performance->Stop(NULL, NULL, 0, 0);
 
-	performance->CloseDown();
-	performance->Release();
-	performance = NULL;
+	if (segment != NULL) {
+		segment->SetParam(GUID_Unload, -1, 0, 0, performance);
+		segment->Release();
+		segment = NULL;
+	}
 
-	loader->Release();
-	loader = NULL;
+	if (performance != NULL) {
+		performance->CloseDown();
+		performance->Release();
+		performance = NULL;
+	}
+
+	if (loader != NULL) {
+		loader->Release();
+		loader = NULL;
+	}
 
 	proc.CoUninitialize();
 }