1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

LibCpp: Fix null dereference in IfStatement::declarations()

This commit is contained in:
Itamar 2021-03-27 18:26:31 +03:00 committed by Andreas Kling
parent 9288dfced8
commit 68f420ed42

View file

@ -408,9 +408,12 @@ void IfStatement::dump(size_t indent) const
NonnullRefPtrVector<Declaration> IfStatement::declarations() const
{
NonnullRefPtrVector<Declaration> declarations;
declarations.append(m_predicate->declarations());
declarations.append(m_then->declarations());
declarations.append(m_else->declarations());
if (m_predicate)
declarations.append(m_predicate->declarations());
if (m_then)
declarations.append(m_then->declarations());
if (m_else)
declarations.append(m_else->declarations());
return declarations;
}