The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: yoyo on June 25, 2012, 01:26:52 PM

Title: r5787 Win pak64 - The program will crash on "UNDO" after remove the power line.
Post by: yoyo on June 25, 2012, 01:26:52 PM
HI!
I found a bug.

steps to crash.
1) make a power line on the ground.
2) remove power line by bulldozer tool.
3) press Z key (undo)

----------------------------------------------------------------
[ simplay.cc ]

  <<< original >>>
    sint64 spieler_t::undo()
    {
      ...
      leitung_t* lt = gr->get_leitung();
      cost += lt->get_besch()->get_preis();
      ...
    }

  <<< my first aid >>>
    sint64 spieler_t::undo()
    {
      ...
      leitung_t* lt = gr->get_leitung();

      if(!lt) continue; // add NULL check.

      cost += lt->get_besch()->get_preis();
      ...
    }

----------------------------------------------------------------
[ environment ]
os            : Windows7 x64
compiler   : Visual C/C++2010 express
simutrans : r5787 / GDI / Win32 Debug / compiled from source code.
pak          : pak64 111.3 / SVN / makeobj=53
libs          : zlib 1.2.7 / libpng 1.5.11 / bzip2 1.0.6
----------------------------------------------------------------

Thank you!
Title: Re: r5787 Win pak64 - The program will crash on "UNDO" after remove the power line.
Post by: Dwachs on June 25, 2012, 03:38:10 PM
Thank you very much for the report & fix. Incorporated in r5788.
Title: Re: r5787 Win pak64 - The program will crash on "UNDO" after remove the power line.
Post by: IgorEliezer on June 26, 2012, 12:42:11 AM
Thank you and welcome to the International Simutrans Forum. :)