shithub: cstory

Download patch

ref: c27d15dddcc8e7a6dff20d2d29cf84658977db96
parent: cb4a9d40b9c661b5f7365d8460ec6646a43166f2
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Aug 15 14:38:36 EDT 2019

Prevent segfault on shutdown

Oddly enough, putting the check in the Release function doesn't fix
it. Makes me wonder how DirectSound did it. I don't know much C++.

--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -263,7 +263,8 @@
 	EndOrganya();
 
 	for (unsigned int i = 0; i < SE_MAX; ++i)
-		lpSECONDARYBUFFER[i]->Release();
+		if (lpSECONDARYBUFFER[i])
+			lpSECONDARYBUFFER[i]->Release();
 
 	SDL_QuitSubSystem(SDL_INIT_AUDIO);