From: Mario Date: Fri, 6 Jan 2017 22:51:47 +0000 (+1000) Subject: Avoid potentially drawing a 'bad string' (better to show no reticle at all than to... X-Git-Tag: xonotic-v0.8.2~318 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2e5a87f45a5401d14f3234c31adbce4707c21d57;p=xonotic%2Fxonotic-data.pk3dir.git Avoid potentially drawing a 'bad string' (better to show no reticle at all than to crash the client) --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index ba53c0341..ae6b0ee76 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1953,7 +1953,7 @@ void CSQC_UpdateView(entity this, float w, float h) if(autocvar_cl_reticle) { - string reticle_image = ""; + string reticle_image = string_null; bool wep_zoomed = false; for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { @@ -1962,7 +1962,7 @@ void CSQC_UpdateView(entity this, float w, float h) if(wep != WEP_Null && wep.wr_zoom) { bool do_zoom = wep.wr_zoom(wep, NULL); - if(reticle_image == "" && wep.w_reticle && wep.w_reticle != "") + if(!reticle_image && wep.w_reticle && wep.w_reticle != "") reticle_image = wep.w_reticle; wep_zoomed += do_zoom; } @@ -1978,7 +1978,7 @@ void CSQC_UpdateView(entity this, float w, float h) } else if(wep_zoomed && autocvar_cl_reticle_weapon) { - if(reticle_image != "") { reticle_type = 2; } + if(reticle_image) { reticle_type = 2; } else { reticle_type = 0; } } else if(button_zoom || zoomscript_caught)