From: terencehill <piuntn@gmail.com>
Date: Sat, 1 Jun 2013 14:09:33 +0000 (+0200)
Subject: Workaround for occasional crashes caused by the hud code (please test)
X-Git-Tag: xonotic-v0.7.0~14^2
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=78d695069baa29c19a0142d27d0a3e94e79eaed9;p=xonotic%2Fxonotic-data.pk3dir.git

Workaround for occasional crashes caused by the hud code (please test)
---

diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index 469fe67fa2..273f427e49 100644
--- a/qcsrc/client/hud.qc
+++ b/qcsrc/client/hud.qc
@@ -264,7 +264,7 @@ HUD panels
 
 // draw the background/borders
 #define HUD_Panel_DrawBg(theAlpha)\
-if(panel_bg != "0")\
+if(panel_bg != "0" && panel_bg != "")\
 	draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER))
 
 //basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh
index 19cd36ddb0..5a7e603351 100644
--- a/qcsrc/client/hud.qh
+++ b/qcsrc/client/hud.qh
@@ -340,8 +340,13 @@ if(panel.update_time <= time) { \
 	} \
 	panel.current_panel_pos = panel_pos; \
 	panel.current_panel_size = panel_size; \
-	if(panel.current_panel_bg != "") \
+	if(panel.current_panel_bg) \
 		strunzone(panel.current_panel_bg); \
+	if(panel_bg == "")\
+	{\
+		print(sprintf("^xf08 %s panel: panel_bg is empty\n", panel.panel_name));\
+		panel_bg = "0";\
+	}\
 	panel.current_panel_bg = strzone(panel_bg); \
 	panel.current_panel_bg_alpha = panel_bg_alpha; \
 	panel.current_panel_bg_border = panel_bg_border; \
@@ -354,6 +359,11 @@ if(panel.update_time <= time) { \
 	panel_pos = panel.current_panel_pos; \
 	panel_size = panel.current_panel_size; \
 	panel_bg = panel.current_panel_bg; \
+	if(panel.current_panel_bg == "")\
+	{\
+		print(sprintf("^xf08 %s panel: panel.current_panel_bg is empty\n", panel.panel_name));\
+		panel_bg = "0";\
+	}\
 	panel_bg_alpha = panel.current_panel_bg_alpha; \
 	panel_bg_border = panel.current_panel_bg_border; \
 	panel_bg_color = panel.current_panel_bg_color; \