I’m subclassing CCControlButton and need to check background sprites during init, which was crashing because the m_backgroundSpriteDispatchTable had not been setup yet. I added a line to check if it has and return NULL if not.
CCScale9Sprite* CCControlButton::getBackgroundSpriteForState(CCControlState state)
if (m_backgroundSpriteDispatchTable == NULL) return NULL; // if called before init is completed
CCScale9Sprite* backgroundSprite = (CCScale9Sprite*)m_backgroundSpriteDispatchTable->objectForKey(state);
Please add to the source.