mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-04 16:26:53 +00:00
HPL1: Fix potential null dereferences
This commit is contained in:
parent
4dfeb27036
commit
54ee96f897
@ -118,8 +118,7 @@ void cStateMachine::ChangeState(int alId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mpCurrentState)
|
||||
mpCurrentState->OnLeaveState(pState->GetId());
|
||||
mpCurrentState->OnLeaveState(pState->GetId());
|
||||
pState->OnEnterState(mpCurrentState == NULL ? -1 : mpCurrentState->GetId());
|
||||
|
||||
mpCurrentState = pState;
|
||||
|
@ -1422,6 +1422,7 @@ cMeshEntity *cMeshLoaderCollada::CreateStaticMeshEntity(cColladaNode *apNode, cW
|
||||
// Log("Created body %s!\n",pBody->GetName().c_str());
|
||||
} else {
|
||||
Log("Body creation failed!\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Check if it blocks light
|
||||
|
@ -268,9 +268,8 @@ void cScene::Render(cUpdater *apUpdater, float afFrameTime) {
|
||||
|
||||
if (mpCurrentWorld2D) {
|
||||
mpCurrentWorld2D->Render(pCamera2D);
|
||||
mpGraphics->GetRenderer2D()->RenderObjects(pCamera2D, mpCurrentWorld2D->GetGridMapLights(), mpCurrentWorld2D);
|
||||
}
|
||||
|
||||
mpGraphics->GetRenderer2D()->RenderObjects(pCamera2D, mpCurrentWorld2D->GetGridMapLights(), mpCurrentWorld2D);
|
||||
} else {
|
||||
cCamera3D *pCamera3D = static_cast<cCamera3D *>(mpActiveCamera);
|
||||
|
||||
|
@ -1378,7 +1378,7 @@ void iGameEnemy::UpdateAnimations(float afTimeStep) {
|
||||
|
||||
/////////////////////////////////
|
||||
// Update animation speed
|
||||
if (mbAnimationIsSpeedDependant) {
|
||||
if (mbAnimationIsSpeedDependant && mpCurrentAnimation) {
|
||||
if (ABS(fSpeed) > 0.05f)
|
||||
mpCurrentAnimation->SetSpeed(ABS(fSpeed) * mfMoveAnimSpeedMul);
|
||||
else
|
||||
|
@ -63,10 +63,9 @@ public:
|
||||
void InitState(iPlayerState *apPrevState) {
|
||||
if (apPrevState) {
|
||||
apPrevState->LeaveState(this);
|
||||
EnterState(apPrevState);
|
||||
mPreviuosState = apPrevState->mType;
|
||||
}
|
||||
|
||||
EnterState(apPrevState);
|
||||
mPreviuosState = apPrevState->mType;
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
@ -96,6 +96,7 @@ void cPreMenu::LoadConfig() {
|
||||
if (pMainElem == NULL) {
|
||||
Error("Couldn't load Main element from XML document 'config/startup.cfg'\n");
|
||||
hplDelete(pXmlDoc);
|
||||
return;
|
||||
}
|
||||
|
||||
mbShowText = cString::ToBool(pMainElem->Attribute("ShowText"), false);
|
||||
@ -106,6 +107,7 @@ void cPreMenu::LoadConfig() {
|
||||
if (pLogosParentElem == NULL) {
|
||||
Error("Couldn't load Logs element from XML document 'config/startup.cfg'\n");
|
||||
hplDelete(pXmlDoc);
|
||||
return;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user