mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Clarified some (im)possible null dereferences
This commit is contained in:
parent
392c360f88
commit
6db405167d
@ -315,7 +315,7 @@ public:
|
||||
void ptrAllocated(const T *ptr, ui32 pid)
|
||||
{
|
||||
if(smartPointerSerialization && pid != 0xffffffff)
|
||||
loadedPointers[pid] = static_cast<void*>(ptr); //add loaded pointer to our lookup map; cast is to avoid errors with const T* pt
|
||||
loadedPointers[pid] = (void*)ptr; //add loaded pointer to our lookup map; cast is to avoid errors with const T* pt
|
||||
}
|
||||
|
||||
template<typename Base, typename Derived> void registerType(const Base * b = nullptr, const Derived * d = nullptr)
|
||||
|
@ -1573,8 +1573,11 @@ bool BattleActionProcessor::makePlayerBattleAction(const CBattleInfoCallback & b
|
||||
else
|
||||
{
|
||||
auto active = battle.battleActiveUnit();
|
||||
if(!active && gameHandler->complain("No active unit in battle!"))
|
||||
if(!active)
|
||||
{
|
||||
gameHandler->complain("No active unit in battle!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ba.isUnitAction() && ba.stackNumber != active->unitId())
|
||||
{
|
||||
@ -1584,8 +1587,11 @@ bool BattleActionProcessor::makePlayerBattleAction(const CBattleInfoCallback & b
|
||||
|
||||
auto unitOwner = battle.battleGetOwner(active);
|
||||
|
||||
if(player != unitOwner && gameHandler->complain("Can not make actions in battles you are not part of!"))
|
||||
if(player != unitOwner)
|
||||
{
|
||||
gameHandler->complain("Can not make actions in battles you are not part of!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return makeBattleActionImpl(battle, ba);
|
||||
|
Loading…
Reference in New Issue
Block a user