[colobot] 19/100: Another this==nullptr fix (#828)
Didier Raboud
odyx at moszumanska.debian.org
Thu Jun 1 18:10:14 UTC 2017
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit b49fbf0cd6ada33a3e0a5850bd8b7b82efd76502
Author: krzys-h <krzys_h at interia.pl>
Date: Fri Nov 11 22:58:39 2016 +0100
Another this==nullptr fix (#828)
---
src/CBot/CBotDefParam.cpp | 1 +
src/CBot/CBotInstr/CBotFunction.cpp | 15 ++++++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/CBot/CBotDefParam.cpp b/src/CBot/CBotDefParam.cpp
index d73c02e..ff4acf1 100644
--- a/src/CBot/CBotDefParam.cpp
+++ b/src/CBot/CBotDefParam.cpp
@@ -104,6 +104,7 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
{
int i = 0;
+ assert(this != nullptr);
CBotDefParam* p = this;
while ( p != nullptr )
diff --git a/src/CBot/CBotInstr/CBotFunction.cpp b/src/CBot/CBotInstr/CBotFunction.cpp
index c8db69a..f86153f 100644
--- a/src/CBot/CBotInstr/CBotFunction.cpp
+++ b/src/CBot/CBotInstr/CBotFunction.cpp
@@ -334,7 +334,10 @@ bool CBotFunction::Execute(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInstance)
if ( pile->GetState() == 0 )
{
- if ( !m_param->Execute(ppVars, pile) ) return false; // define parameters
+ if (m_param != nullptr)
+ {
+ if ( !m_param->Execute(ppVars, pile) ) return false; // define parameters
+ }
pile->IncState();
}
@@ -647,7 +650,10 @@ int CBotFunction::DoCall(CBotProgram* program, const std::list<CBotFunction*>& l
}
// initializes the variables as parameters
- pt->m_param->Execute(ppVars, pStk3); // cannot be interrupted
+ if (pt->m_param != nullptr)
+ {
+ pt->m_param->Execute(ppVars, pStk3); // cannot be interrupted
+ }
pStk1->IncState();
}
@@ -766,7 +772,10 @@ int CBotFunction::DoCall(const std::list<CBotFunction*>& localFunctionList, long
pStk->AddVar(psuper);
}
// initializes the variables as parameters
- pt->m_param->Execute(ppVars, pStk3); // cannot be interrupted
+ if (pt->m_param != nullptr)
+ {
+ pt->m_param->Execute(ppVars, pStk3); // cannot be interrupted
+ }
pStk->IncState();
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list