From facc1888c5095c8bb1b8e4ce16dc98f8acb9924b Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sat, 8 Mar 2025 12:46:00 +0100 Subject: [PATCH] fix crash, when no cost for upgrade --- client/windows/CCastleInterface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index adf5f1cbd..56e728fbd 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -398,6 +398,8 @@ void CHeroGSlot::gesture(bool on, const Point & initialPosition, const Point & f std::vector> resComps; for(TResources::nziterator i(upgradableSlots.totalCosts); i.valid(); i++) resComps.push_back(std::make_shared(ComponentType::RESOURCE, i->resType, i->resVal)); + if(!resComps.size()) + resComps.push_back(std::make_shared(ComponentType::RESOURCE, static_cast(GameResID::GOLD), 0)); // add at least gold, when there are no costs resComps.back()->newLine = true; for(auto & upgradeInfo : upgradableSlots.upgradeInfos) resComps.push_back(std::make_shared(ComponentType::CREATURE, upgradeInfo.second.getUpgrade(), obj->Slots().at(upgradeInfo.first)->count));