From 309feb665ffe9f619730b532e9fa4ec5b4e0ae39 Mon Sep 17 00:00:00 2001
From: havoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Wed, 8 Oct 2003 02:37:00 +0000
Subject: [PATCH] snd_initialized is now checked by S_FindName and
 S_PrecacheSound (Thanks to Moz for reporting the -nosound crash)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3551 d7cf8633-e32d-0410-b094-e92efae38249
---
 snd_dma.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/snd_dma.c b/snd_dma.c
index 071710e2..8e749b69 100644
--- a/snd_dma.c
+++ b/snd_dma.c
@@ -274,6 +274,9 @@ sfx_t *S_FindName (char *name)
 	int i;
 	sfx_t *sfx;
 
+	if (!snd_initialized)
+		return NULL;
+
 	if (!name)
 		Host_Error("S_FindName: NULL\n");
 
@@ -316,9 +319,12 @@ sfx_t *S_PrecacheSound (char *name, int complain)
 {
 	sfx_t *sfx;
 
+	if (!snd_initialized)
+		return NULL;
+
 	sfx = S_FindName(name);
 
-	if (snd_initialized && !nosound.integer && snd_precache.integer)
+	if (!nosound.integer && snd_precache.integer)
 		S_LoadSound(sfx, complain);
 
 	return sfx;
-- 
2.39.5