The International Simutrans Forum

 

Author Topic: r5787 Win pak64 - The program will crash on "UNDO" after remove the power line.  (Read 1374 times)

0 Members and 1 Guest are viewing this topic.

yoyo

  • Guest
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!

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Thank you very much for the report & fix. Incorporated in r5788.

Offline IgorEliezer

  • Devotee
  • Administrator
  • *
  • Posts: 4112
  • I have nothing to do with it!
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
Thank you and welcome to the International Simutrans Forum. :)