Merge pull request #13000 from yangws/v3

Fix bug: app will crash if move mouse over window when launching.
This commit is contained in:
pandamicro 2015-07-24 20:11:25 +08:00
commit a256df68c1
1 changed files with 3 additions and 2 deletions

View File

@ -811,7 +811,8 @@ void EventDispatcher::dispatchTouchEventToListeners(EventListenerVector* listene
}
}
if (sceneGraphPriorityListeners)
auto scene = Director::getInstance()->getRunningScene();
if (scene && sceneGraphPriorityListeners)
{
if (!shouldStopPropagation)
{
@ -829,7 +830,7 @@ void EventDispatcher::dispatchTouchEventToListeners(EventListenerVector* listene
// second, for all camera call all listeners
// get a copy of cameras, prevent it's been modified in linstener callback
// if camera's depth is greater, process it earler
auto cameras = Director::getInstance()->getRunningScene()->getCameras();
auto cameras = scene->getCameras();
Camera* camera;
for (int j = int(cameras.size()) - 1; j >= 0; --j)
{