<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39417 >

2007/6/25, Marko Lindqvist <[EMAIL PROTECTED]>:
>
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=39417 >
>
> On 6/25/07, Ulrik Sverdrup <[EMAIL PROTECTED]> wrote:
> >
> > I'm sorry this is of course in the ruleset, the Warships sea unit with
> > BarbarianTech instead of BarbarianSea
> >
> > Do we need a sanity check for that in the code?
>
>  Trunk already has sanity checking for that.
>
>
>  - ML
>

If the sanitychecks are not supposed to crash we need something like
this since transporter can be NULL here and if it is we get a null
dereference

>

Index: sanitycheck.c
===================================================================
--- sanitycheck.c	(revision 13022)
+++ sanitycheck.c	(arbetskopia)
@@ -431,7 +431,10 @@
       /* Check for ground units in the ocean. */
       if (!can_unit_exist_at_tile(punit, ptile)) {
         SANITY_CHECK(punit->transported_by != -1);
-        SANITY_CHECK(can_unit_transport(transporter, punit));
+        transporter = find_unit_by_id(punit->transported_by);
+        if (transporter) {
+          SANITY_CHECK(can_unit_transport(transporter, punit));
+        }
       }
 
       /* Check for over-full transports. */
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to