1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix crash on right-clicking rewardable objects with no hero selected

This commit is contained in:
Ivan Savenko 2023-11-01 00:11:02 +02:00
parent 10e50548e7
commit f201e3019a

View File

@ -35,7 +35,7 @@ std::vector<ui32> Rewardable::Interface::getAvailableRewards(const CGHeroInstanc
{
const Rewardable::VisitInfo & visit = configuration.info[i];
if(event == visit.visitType && visit.limiter.heroAllowed(hero))
if(event == visit.visitType && (!hero || visit.limiter.heroAllowed(hero)))
{
logGlobal->trace("Reward %d is allowed", i);
ret.push_back(static_cast<ui32>(i));