Follow-up Comment #1, bug #16800 (project freeciv):

Below some code from sanitycheck.c (line 403ff) is listed:


      if (punit->transported_by != -1) {
        transporter = game_find_unit_by_number(punit->transported_by);
        SANITY_CHECK(transporter != NULL);

        /* Make sure the transporter is on the tile. */
        unit_list_iterate(punit->tile->units, tile_unit) {
          if (tile_unit == transporter) {
            transporter2 = tile_unit;
          }
        } unit_list_iterate_end;
        SANITY_CHECK(transporter2 != NULL);

        /* Also in the list of owner? */
        SANITY_CHECK(player_find_unit_by_id(unit_owner(transporter),
                                      punit->transported_by) != NULL);
        SANITY_CHECK(same_pos(ptile, transporter->tile));

        /* Transporter capacity will be checked when transporter itself
         * is checked */
      }

      /* 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));
      }


The value for transporter is set in the first condition. But, in the second
condition this value is used. At this point it will be NULL if the first one
was not executed. Thus, the first sanity check fails and the second sanity
check results in a core dump in unit_type() due to NULL->utype.

>From the log file:

1: [T063 - 2010/10/02 12:43:47] in begin_phase() [srv_main.c::827]: assertion
'punit->transported_by != -1
' failed.



    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?16800>

_______________________________________________
  Nachricht geschickt von/durch Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to