Andrettin / Wyrmsun

Strategy game based on history, mythology and fiction
http://andrettin.github.io/
GNU General Public License v2.0
301 stars 47 forks source link

Gryphon riders cannot read book of retainment (?) #106

Closed KroArtem closed 8 years ago

KroArtem commented 8 years ago

If gryphon rider tries to read a book that allows to return all points spent on unit upgrade, Wyrmsun segfaults.

Thread 1 "stratagus-dbg" received signal SIGSEGV, Segmentation fault.
0x0000000000991ee9 in CUnit::Retrain (this=0x263dfd60)
    at /home/kroartem/Wyrmgus/src/unit/unit.cpp:701
701                 if (AiHelpers.ExperienceUpgrades[i][j] == this->Type) {
(gdb) bt
#0  0x0000000000991ee9 in CUnit::Retrain (this=0x263dfd60)
    at /home/kroartem/Wyrmgus/src/unit/unit.cpp:701
#1  0x00000000007be53e in Spell_Retrain::Cast (this=0xa449320, caster=..., 
    goalPos=...) at /home/kroartem/Wyrmgus/src/spell/spell_retrain.cpp:65
#2  0x00000000007c33ce in SpellCast (caster=..., spell=..., target=0x263dfd60, 
    goalPos=...) at /home/kroartem/Wyrmgus/src/spell/spells.cpp:605
#3  0x00000000006b3ec5 in COrder_SpellCast::Execute (this=0x260573a0, unit=...)
    at /home/kroartem/Wyrmgus/src/action/action_spellcast.cpp:443
#4  0x00000000006c2149 in HandleUnitAction (unit=...)
    at /home/kroartem/Wyrmgus/src/action/actions.cpp:505
#5  0x00000000006c2897 in UnitActionsEachCycle<__gnu_cxx::__normal_iterator<CUnit**, std::vector<CUnit*> > > (begin=, end=)
    at /home/kroartem/Wyrmgus/src/action/actions.cpp:596
#6  0x00000000006c2516 in UnitActions ()
    at /home/kroartem/Wyrmgus/src/action/actions.cpp:626
#7  0x000000000084f762 in GameLogicLoop ()
    at /home/kroartem/Wyrmgus/src/stratagus/mainloop.cpp:487
#8  0x000000000084fe48 in SingleGameLoop ()
    at /home/kroartem/Wyrmgus/src/stratagus/mainloop.cpp:670
#9  0x0000000000850138 in GameMainLoop ()
    at /home/kroartem/Wyrmgus/src/stratagus/mainloop.cpp:729
#10 0x0000000000710abd in StartMap (
    filename="maps/random/random-map-swamp.smp", clean=true)
---Type <return> to continue, or q <return> to quit---
    at /home/kroartem/Wyrmgus/src/game/game.cpp:193
#11 0x0000000000a1903a in tolua_stratagus_StartMap00 (tolua_S=0x1ad0be0)
    at /home/kroartem/Wyrmgus/tolua.cpp:1075
Andrettin commented 8 years ago

Fixed :) https://github.com/Andrettin/Wyrmgus/commit/7a55576abd9d1f9ad548e22e017a1d5581851626