From 8ebb38c2818b00ee0766abe1d344f8c4bfea5f0e Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Fri, 17 Jan 2025 23:30:39 +0700 Subject: [PATCH] Prevent a potential division by zero. --- src/debug/AirVelocity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug/AirVelocity.cpp b/src/debug/AirVelocity.cpp index 44c69fa62..794c39cad 100644 --- a/src/debug/AirVelocity.cpp +++ b/src/debug/AirVelocity.cpp @@ -41,7 +41,7 @@ void AirVelocity::Draw() if (width*std::abs(dy) < height*std::abs(dx)) diff = ((float)width)/((float)std::abs(dx)); else - diff = ((float)height)/((float)std::abs(dy)); + diff = (dy == 0) ? 0 : (((float)height)/((float)std::abs(dy))); float circx = (diff/1.5f) * (endx - pos.X) + endx; float circy = (diff/1.5f) * (endy - pos.Y) + endy;