crash on Geologist find resource: Widelands::kNoResource' failed

Bug #1603763 reported by kaputtnik
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Medium
TiborB

Bug Description

Very rarely i got a crash when sending out geologists on some maps:

src/logic/map_objects/world/world.cc:163: const Widelands::ResourceDescription* Widelands::World::get_resource(Widelands::DescriptionIndex) const: Assertion `res < resources_->size() || res == Widelands::kNoResource' failed.

First i couldn't reproduce this crash but now i found a way: Attached is scenario containing only a headquarter and immediately after loading two geologist are send out. If one of them investigates the field 1/12 the crash happens reproducible.

The crash happens also when one tries to use the dbg info on this field. But only when the map is used for a game, not when loading into editor.

Related branches

Revision history for this message
kaputtnik (franku) wrote :
Revision history for this message
kaputtnik (franku) wrote :

This bug seems to be only existent in scenarios. I remember playing a barbarian campaign when i stumbled the first time over this and the second time it was during playing the scenario "The green plateau". When the scripting is removed from the attached scenario the bug is gone...

Revision history for this message
TiborB (tiborb95) wrote :

I seems that recalc_default_resources was a culprit - sometimes it set the resource to 255 (INVALID_RESOURCE), while allowed is only existing resource or kNoResource. I created a branch with proposed fix

Changed in widelands:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → TiborB (tiborb95)
milestone: none → build19-rc1
Revision history for this message
kaputtnik (franku) wrote :

That stuff is really complicated :-D Thanks for looking into it!

I played around with the map and created more such invalid resource fields. It looks to me that this happens when dry terrains (with no water) are adjacent in specific positions to terrains which have default amount of water.

I test your changes...

Revision history for this message
kaputtnik (franku) wrote :

For further investigating a scenario is attached which crash when debugging position 0/0 with trunk.

With Tibors branch no crash anymore.

Revision history for this message
kaputtnik (franku) wrote :

I mark this as fix committet. If one want's to investigate further he/she could change the status again.

Changed in widelands:
status: Confirmed → Fix Committed
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.