Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] (PR#2634) ai_military_attack() bug#2
Home

[Freeciv-Dev] (PR#2634) ai_military_attack() bug#2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2634) ai_military_attack() bug#2
From: "Per I. Mathisen via RT" <rt@xxxxxxxxxxxxxx>
Date: Mon, 23 Dec 2002 06:21:48 -0800
Reply-to: rt@xxxxxxxxxxxxxx

@@ -1996,6 +2028,9 @@
         UNIT_LOG(LOG_DEBUG, punit, "mil att bash -> %d, %d", dest_x, dest_y);
         ai_unit_attack(punit, dest_x, dest_y);
       }
+      if (!(punit = find_unit_by_id(id))) {
+        return; /* we died */
+      }
      } /* while */
     } else {
       /* FIXME: This happens a bit too often! */
@@ -2004,10 +2039,8 @@
       ct = 0;
     }

-    if (!(punit = find_unit_by_id(id))) {
-      return; /* we died */
-    }
     ct--; /* infinite loops from railroads must be stopped */

It is possible to attack and die, and still do another loop in
ai_military_attack, leading to a core dump. If we add the first check, we
can remove the latter. This should be fixed for S1_14 as well as head, but
for S1_14 we can keep the latter check as well to be absolutely sure.

  - Per




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2634) ai_military_attack() bug#2, Per I. Mathisen via RT <=