Please sign in to comment.
CCMenu - prevent a crash if some child item is not CCMenuItem
CCMenu::itemForTouch expects that all children are CCMenuItems. But it is still possible to add other child types, for example if CCAssert is disabled or some other addChild method is called. In this case dynamic_cast to CCNode and later try to do ((CCMenuItem*)pChild)->isEnabled() triggers an undefined behaviour - up to a crash or something else. Fixed by a dynamic_cast straightforward to CCMenuItem.
- Loading branch information...