Prevent a potential division by zero.

This commit is contained in:
Saveliy Skresanov
2025-01-17 23:30:39 +07:00
parent f7bedb3b5f
commit 8ebb38c281

View File

@@ -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;