MantisBT - VCMI
View Issue Details
0001994VCMIGUI - Otherpublic2014-12-22 11:242015-01-02 04:52
SXX 
SXX 
normalcrashalways
closedfixed 
0.97 
0.97b 
0001994: Dismissal of last troop of a hero is possible and cause crash
Dismiss button on last troop should be grayed out.

Considering there is task 0000364 it's looks like that worked properly long time ago, but then was broken.
No tags attached.
related to 0000364closed Ivan You can attempt to dismiss the last troop of a hero, but when you click Yes nothing happens. 
Issue History
2014-12-22 11:24SXXNew Issue
2014-12-22 11:24SXXRelationship addedrelated to 0000364
2014-12-23 02:13SXXAssigned To => SXX
2014-12-23 02:13SXXStatusnew => assigned
2014-12-23 02:23SXXNote Added: 0005250
2014-12-23 02:23SXXNote Edited: 0005250bug_revision_view_page.php?bugnote_id=5250#r2757
2014-12-23 04:10SXXNote Edited: 0005250bug_revision_view_page.php?bugnote_id=5250#r2758
2014-12-24 14:22SXXNote Added: 0005261
2014-12-24 14:22SXXStatusassigned => resolved
2014-12-24 14:22SXXFixed in Version => 0.97b
2014-12-24 14:22SXXResolutionopen => fixed
2014-12-24 14:22SXXNote Edited: 0005261bug_revision_view_page.php?bugnote_id=5261#r2762
2015-01-02 04:52SXXStatusresolved => closed

Notes
(0005250)
SXX   
2014-12-23 02:23   
(edited on: 2014-12-23 04:10)
So here window troops using CGarrisonSlot and CGarrisonSlot::clickLeft does have check that does work and set canUpgrade to false. As result "dism" callback that passed into CStackWindow is nullptr.

Though funny thing is that check at /client/windows/CCreatureWindow.cpp:531
	if (parent->info->dismissInfo)

"dismissInfo" is properly initizlized object so button appear and of course game will crash once it's try to call nullptr.

Though if check "callback" explicitly for nullptr everything work properly:
	if (parent->info->dismissInfo->callback != nullptr)


(0005261)
SXX   
2014-12-24 14:22   
Fixed:
https://github.com/vcmi/vcmi/commit/8a697f2ba3fe37ea225050e1f9cf5bc71cb1362b [^]