mirror of https://github.com/axmolengine/axmol.git
fix bug: fix crash when lack of projected file
This commit is contained in:
parent
0d872ae1d7
commit
a1a7273436
|
@ -481,6 +481,9 @@ InnerActionFrame::InnerActionFrame()
|
||||||
void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
{
|
{
|
||||||
auto innerActiontimeline = static_cast<ActionTimeline*>(_node->getActionByTag(_node->getTag()));
|
auto innerActiontimeline = static_cast<ActionTimeline*>(_node->getActionByTag(_node->getTag()));
|
||||||
|
if( nullptr == innerActiontimeline)
|
||||||
|
return;
|
||||||
|
|
||||||
if (InnerActionType::SingleFrame == _innerActionType)
|
if (InnerActionType::SingleFrame == _innerActionType)
|
||||||
{
|
{
|
||||||
innerActiontimeline->gotoFrameAndPause(_singleFrameIndex);
|
innerActiontimeline->gotoFrameAndPause(_singleFrameIndex);
|
||||||
|
|
|
@ -833,20 +833,24 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree)
|
||||||
auto projectNodeOptions = (ProjectNodeOptions*)options->data();
|
auto projectNodeOptions = (ProjectNodeOptions*)options->data();
|
||||||
std::string filePath = projectNodeOptions->fileName()->c_str();
|
std::string filePath = projectNodeOptions->fileName()->c_str();
|
||||||
CCLOG("filePath = %s", filePath.c_str());
|
CCLOG("filePath = %s", filePath.c_str());
|
||||||
|
|
||||||
|
cocostudio::timeline::ActionTimeline* action = nullptr;
|
||||||
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
|
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
|
||||||
{
|
{
|
||||||
|
|
||||||
node = createNodeWithFlatBuffersFile(filePath);
|
node = createNodeWithFlatBuffersFile(filePath);
|
||||||
reader->setPropsWithFlatBuffers(node, options->data());
|
action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
|
||||||
|
|
||||||
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
|
|
||||||
if (action)
|
|
||||||
{
|
|
||||||
node->runAction(action);
|
|
||||||
action->gotoFrameAndPause(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node = Node::create();
|
||||||
|
}
|
||||||
|
reader->setPropsWithFlatBuffers(node, options->data());
|
||||||
|
if (action)
|
||||||
|
{
|
||||||
|
node->runAction(action);
|
||||||
|
action->gotoFrameAndPause(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (classname == "SimpleAudio")
|
else if (classname == "SimpleAudio")
|
||||||
{
|
{
|
||||||
|
@ -1164,17 +1168,22 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
|
||||||
std::string filePath = projectNodeOptions->fileName()->c_str();
|
std::string filePath = projectNodeOptions->fileName()->c_str();
|
||||||
CCLOG("filePath = %s", filePath.c_str());
|
CCLOG("filePath = %s", filePath.c_str());
|
||||||
|
|
||||||
|
cocostudio::timeline::ActionTimeline* action = nullptr;
|
||||||
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
|
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
|
||||||
{
|
{
|
||||||
node = createNodeWithFlatBuffersForSimulator(filePath);
|
node = createNodeWithFlatBuffersFile(filePath);
|
||||||
reader->setPropsWithFlatBuffers(node, options->data());
|
action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
|
||||||
|
|
||||||
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator(filePath);
|
}
|
||||||
if (action)
|
else
|
||||||
{
|
{
|
||||||
node->runAction(action);
|
node = Node::create();
|
||||||
action->gotoFrameAndPause(0);
|
}
|
||||||
}
|
reader->setPropsWithFlatBuffers(node, options->data());
|
||||||
|
if (action)
|
||||||
|
{
|
||||||
|
node->runAction(action);
|
||||||
|
action->gotoFrameAndPause(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (classname == "SimpleAudio")
|
else if (classname == "SimpleAudio")
|
||||||
|
|
2
plugin
2
plugin
|
@ -1 +1 @@
|
||||||
Subproject commit dc25546289ab18dd273199124dada948638eb5e1
|
Subproject commit 3609894790678a7a3a9e66cefe881f75534f98b0
|
Loading…
Reference in New Issue