MantisBT - VCMI
View Issue Details
0002390VCMIAI - Adventure Mappublic2016-01-19 17:292016-01-23 19:15
vmarkovtsev 
vmarkovtsev 
normalcrashalways
resolvedfixed 
DarwinMacOSX10.11.2
0.98f 
0.98g 
0002390: VisitHero::fulfillsMe segfaults if the object is not found
AI/VCAI/Goals.cpp, near line 438:

if (goal->goalType == Goals::VISIT_TILE && cb->getObj(ObjectInstanceID(objid))->visitablePos() == goal->tile)

In my particular case, cb->getObj(ObjectInstanceID(objid)) returns nullptr and the game crashes.
Map "Resource War" (standard), load the provided save. End turn.
No tags attached.
duplicate of 0002374assigned SXX VisitHero::fulfillsMe goal check used after battle with killed hero 
zip save.zip (1,054,581) 2016-01-19 17:29
https://bugs.vcmi.eu/file_download.php?file_id=2438&type=bug
Issue History
2016-01-19 17:29vmarkovtsevNew Issue
2016-01-19 17:29vmarkovtsevStatusnew => assigned
2016-01-19 17:29vmarkovtsevAssigned To => Warmonger
2016-01-19 17:29vmarkovtsevFile Added: save.zip
2016-01-19 17:32vmarkovtsevNote Added: 0006315
2016-01-19 17:34vmarkovtsevNote Added: 0006316
2016-01-19 21:58SXXRelationship addedduplicate of 0002374
2016-01-19 22:07SXXNote Added: 0006320
2016-01-23 19:15SXXNote Added: 0006360
2016-01-23 19:15SXXStatusassigned => resolved
2016-01-23 19:15SXXFixed in Version => 0.98g
2016-01-23 19:15SXXResolutionopen => fixed
2016-01-23 19:15SXXAssigned ToWarmonger => vmarkovtsev

Notes
(0006315)
vmarkovtsev   
2016-01-19 17:32   
https://github.com/vcmi/vcmi/pull/159 [^]
(0006316)
vmarkovtsev   
2016-01-19 17:34   
Crash stack trace:

0 libvcmi.dylib 0x00000001088bedf1 CGObjectInstance::visitablePos() const + 17
1 libVCAI.dylib 0x0000000112220dda Goals::VisitHero::fulfillsMe(std::__1::shared_ptr<Goals::AbstractGoal>) + 74
2 libVCAI.dylib 0x0000000112195158 VCAI::striveToGoalInternal(std::__1::shared_ptr<Goals::AbstractGoal>, bool) + 8312
3 libVCAI.dylib 0x000000011217cc27 VCAI::striveToGoal(std::__1::shared_ptr<Goals::AbstractGoal>) + 167
4 libVCAI.dylib 0x000000011217b887 VCAI::makeTurnInternal() + 2327
5 libVCAI.dylib 0x0000000112172df7 VCAI::makeTurn() + 1863
6 libboost_thread-mt.dylib 0x00000001092f2715 boost::(anonymous namespace)::thread_proxy(void*) + 53
7 libsystem_pthread.dylib 0x00007fff883bdc13 _pthread_body + 131
8 libsystem_pthread.dylib 0x00007fff883bdb90 _pthread_start + 168
9 libsystem_pthread.dylib 0x00007fff883bb375 thread_start + 13
(0006320)
SXX   
2016-01-19 22:07   
It's a fix for crash, but sadly it's not a fix for an actual bug in goals code.
(0006360)
SXX   
2016-01-23 19:15   
Crash is fixed in pull request above. Though I'll leave 0002374 open for actual logical bug within VCAI. I'm really want to find out if fact how invalid logic affect goals there.

So this one is fixed while underlying problem need more work.