From: divverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Fri, 17 Dec 2010 09:15:31 +0000 (+0000)
Subject: do not crash if loading a particlefont texture fails
X-Git-Tag: xonotic-v0.5.0~438^2~172
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5d2b95c144c380be28cb219d528415f37e0b3f24;p=xonotic%2Fdarkplaces.git

do not crash if loading a particlefont texture fails

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10669 d7cf8633-e32d-0410-b094-e92efae38249
---

diff --git a/cl_particles.c b/cl_particles.c
index 679778a5..a1af7730 100644
--- a/cl_particles.c
+++ b/cl_particles.c
@@ -1983,6 +1983,7 @@ static void R_InitParticleTexture (void)
 	char *buf;
 	fs_offset_t filesize;
 	char texturename[MAX_QPATH];
+	skinframe_t *sf;
 
 	// a note: decals need to modulate (multiply) the background color to
 	// properly darken it (stain), and they need to be able to alpha fade,
@@ -2241,7 +2242,13 @@ static void R_InitParticleTexture (void)
 				Con_Printf("particles/particlefont.txt: texnum %i outside valid range (0 to %i)\n", i, MAX_PARTICLETEXTURES);
 				continue;
 			}
-			particletexture[i].texture = R_SkinFrame_LoadExternal(texturename, TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, false)->base;
+			sf = R_SkinFrame_LoadExternal(texturename, TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, true);
+			if(!sf)
+			{
+				// R_SkinFrame_LoadExternal already complained
+				continue;
+			}
+			particletexture[i].texture = sf->base;
 			particletexture[i].s1 = s1;
 			particletexture[i].t1 = t1;
 			particletexture[i].s2 = s2;