mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2367 from dumganhar/iss1862-setContainer
fixed #1862: CCScrollView::setContainer may cause dangling pointer when NULL is passed into.
This commit is contained in:
commit
a06d2c44c1
|
@ -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