From 9d8d9b4f7bc1ec9c8a3a9d36c08b90f193ca89ab Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 20 Jan 2024 13:34:35 +0100 Subject: [PATCH] Fix #2893 "cl_zoomfactor 1 results in division by zero"; also simplify the current_viewzoom check (almost_equals performs redundant checks in this case) --- qcsrc/client/view.qc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index a84d21ce8..689f4b4ce 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -481,7 +481,7 @@ vector GetCurrentFov(float fov) } } - if(almost_equals(current_viewzoom, 1)) + if(zoomfactor == 1 || current_viewzoom > 0.999) // zoomfactor check prevents a division by 0 current_zoomfraction = 0; else if(almost_equals(current_viewzoom, 1/zoomfactor)) current_zoomfraction = 1; -- 2.39.2