mirror of https://github.com/axmolengine/axmol.git
fixed #1862: CCScrollView::setContainer may cause dangling pointer when NULL is passed into.
This commit is contained in:
parent
fdd6529bd2
commit
6c15c75c78
|
@ -305,10 +305,12 @@ CCNode * CCScrollView::getContainer()
|
|||
|
||||
void CCScrollView::setContainer(CCNode * pContainer)
|
||||
{
|
||||
// Make sure that 'm_pContainer' has a non-NULL value since there are
|
||||
// lots of logic that use 'm_pContainer'.
|
||||
if (NULL == pContainer)
|
||||
return;
|
||||
|
||||
this->removeAllChildrenWithCleanup(true);
|
||||
|
||||
if (!pContainer) return;
|
||||
|
||||
this->m_pContainer = pContainer;
|
||||
|
||||
this->m_pContainer->ignoreAnchorPointForPosition(false);
|
||||
|
|
Loading…
Reference in New Issue