Remove remaining occurences of "this == nullptr" (#828)
parent
191151eb7b
commit
35d60aaae5
|
@ -363,8 +363,7 @@ bool CBotProgram::RestoreState(FILE* pf)
|
|||
}
|
||||
|
||||
// retrieves the stack from the memory
|
||||
// uses a nullptr pointer (m_stack) but it's ok like that
|
||||
// TODO: no it's not okay like that! but it looks like it doesn't get optimized out at least ~krzys_h
|
||||
m_stack = CBotStack::AllocateStack();
|
||||
if (!m_stack->RestoreState(pf, m_stack)) return false;
|
||||
m_stack->SetProgram(this); // bases for routines
|
||||
|
||||
|
|
|
@ -192,8 +192,18 @@ bool CBotStack::Return(CBotStack* pfils)
|
|||
m_var = pfils->m_var; // result transmitted
|
||||
pfils->m_var = nullptr; // not to destroy the variable
|
||||
|
||||
if (m_next != nullptr) m_next->Delete();m_next = nullptr; // releases the stack above
|
||||
if (m_next2 != nullptr) m_next2->Delete();m_next2 = nullptr; // also the second stack (catch)
|
||||
if (m_next != nullptr)
|
||||
{
|
||||
// releases the stack above
|
||||
m_next->Delete();
|
||||
m_next = nullptr;
|
||||
}
|
||||
if (m_next2 != nullptr)
|
||||
{
|
||||
// also the second stack (catch)
|
||||
m_next2->Delete();
|
||||
m_next2 = nullptr;
|
||||
}
|
||||
|
||||
return IsOk(); // interrupted if error
|
||||
}
|
||||
|
@ -731,8 +741,7 @@ bool CBotStack::RestoreState(FILE* pf, CBotStack* &pStack)
|
|||
if (!ReadWord(pf, w)) return false;
|
||||
if ( w == 0 ) return true; // 0 - terminator
|
||||
|
||||
if ( this == nullptr ) pStack = AllocateStack();
|
||||
else pStack = AddStack();
|
||||
pStack = AddStack();
|
||||
|
||||
if ( w == 2 ) // 2 - m_next2
|
||||
{
|
||||
|
|
|
@ -199,7 +199,7 @@ const CBotToken& CBotToken::operator=(const CBotToken& src)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CBotToken::GetType()
|
||||
{
|
||||
if (this == nullptr) return 0;
|
||||
assert(this != nullptr);
|
||||
if (m_type == TokenTypKeyWord) return m_keywordId;
|
||||
return m_type;
|
||||
}
|
||||
|
@ -225,14 +225,14 @@ void CBotToken::SetString(const std::string& name)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CBotToken::GetStart()
|
||||
{
|
||||
if (this == nullptr) return -1;
|
||||
assert(this != nullptr);
|
||||
return m_start;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CBotToken::GetEnd()
|
||||
{
|
||||
if (this == nullptr) return -1;
|
||||
assert(this != nullptr);
|
||||
return m_end;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue