From 78d695069baa29c19a0142d27d0a3e94e79eaed9 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 1 Jun 2013 16:09:33 +0200 Subject: [PATCH] Workaround for occasional crashes caused by the hud code (please test) --- qcsrc/client/hud.qc | 2 +- qcsrc/client/hud.qh | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 469fe67fa..273f427e4 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 19cd36ddb..5a7e60335 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; \ -- 2.39.2