From 40d0a9fcde6e40654159d73525ed6ee529f095d4 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 3 May 2026 19:57:50 +0300
Subject: [PATCH 10/10] AI: Fix floating point exception at air unit handling

Reported by gusrestrepo

See RM #2012

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 ai/default/aiair.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ai/default/aiair.c b/ai/default/aiair.c
index a2ffc693d1..3050c76e25 100644
--- a/ai/default/aiair.c
+++ b/ai/default/aiair.c
@@ -64,8 +64,10 @@ static inline int regen_turns(struct unit *punit, struct tile *ptile,
   recov = get_unit_bonus(punit, EFT_UNIT_RECOVER);
   if (lost_hp - recov <= 0) {
     res = 0;
-  } else {
+  } else if (recov + regen > 0) {
     res = 1 + (lost_hp - recov) / (recov + regen);
+  } else {
+    return MAX_UINT32;
   }
   punit->tile = real_tile;
 
-- 
2.53.0

