1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

client/NetpacksClient.cpp: Called C++ object pointer is null

Null pointers should not be dereferenced
This commit is contained in:
Alexander Wilms 2023-10-27 20:56:31 +00:00
parent 03835236fb
commit d2c03773cd

View File

@ -367,19 +367,27 @@ void ApplyClientNetPackVisitor::visitGiveBonus(GiveBonus & pack)
void ApplyFirstClientNetPackVisitor::visitChangeObjPos(ChangeObjPos & pack)
{
CGObjectInstance *obj = gs.getObjInstance(pack.objid);
if(CGI->mh)
CGI->mh->onObjectFadeOut(obj, pack.initiator);
CGI->mh->waitForOngoingAnimations();
if(CGI)
{
if(CGI->mh)
{
CGI->mh->onObjectFadeOut(obj, pack.initiator);
CGI->mh->waitForOngoingAnimations();
}
}
}
void ApplyClientNetPackVisitor::visitChangeObjPos(ChangeObjPos & pack)
{
CGObjectInstance *obj = gs.getObjInstance(pack.objid);
if(CGI->mh)
CGI->mh->onObjectFadeIn(obj, pack.initiator);
CGI->mh->waitForOngoingAnimations();
if(CGI)
{
if(CGI->mh)
{
CGI->mh->onObjectFadeIn(obj, pack.initiator);
CGI->mh->waitForOngoingAnimations();
}
}
cl.invalidatePaths();
}