mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13527 from pandamicro/reader
Fix skybox parser crash with inexistent files
This commit is contained in:
commit
50c8855399
|
@ -385,9 +385,17 @@ namespace cocostudio
|
||||||
std::string downFileData = options->downFileData()->path()->c_str();
|
std::string downFileData = options->downFileData()->path()->c_str();
|
||||||
std::string forwardFileData = options->forwardFileData()->path()->c_str();
|
std::string forwardFileData = options->forwardFileData()->path()->c_str();
|
||||||
std::string backFileData = options->backFileData()->path()->c_str();
|
std::string backFileData = options->backFileData()->path()->c_str();
|
||||||
|
FileUtils *fileUtils = FileUtils::getInstance();
|
||||||
|
|
||||||
if (leftFileData.empty() || rightFileData.empty() || upFileData.empty() || downFileData.empty() || forwardFileData.empty() || backFileData.empty())
|
if (!fileUtils->isFileExist(leftFileData)
|
||||||
|
|| !fileUtils->isFileExist(rightFileData)
|
||||||
|
|| !fileUtils->isFileExist(upFileData)
|
||||||
|
|| !fileUtils->isFileExist(downFileData)
|
||||||
|
|| !fileUtils->isFileExist(forwardFileData)
|
||||||
|
|| !fileUtils->isFileExist(backFileData))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Skybox* childBox = Skybox::create(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData);
|
Skybox* childBox = Skybox::create(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData);
|
||||||
unsigned short cameraFlag = 1 << 10;
|
unsigned short cameraFlag = 1 << 10;
|
||||||
childBox->setCameraMask(cameraFlag);
|
childBox->setCameraMask(cameraFlag);
|
||||||
|
|
|
@ -429,9 +429,17 @@ namespace cocostudio
|
||||||
std::string downFileData = options->downFileData()->path()->c_str();
|
std::string downFileData = options->downFileData()->path()->c_str();
|
||||||
std::string forwardFileData = options->forwardFileData()->path()->c_str();
|
std::string forwardFileData = options->forwardFileData()->path()->c_str();
|
||||||
std::string backFileData = options->backFileData()->path()->c_str();
|
std::string backFileData = options->backFileData()->path()->c_str();
|
||||||
|
FileUtils *fileUtils = FileUtils::getInstance();
|
||||||
|
|
||||||
if (leftFileData.empty() || rightFileData.empty() || upFileData.empty() || downFileData.empty() || forwardFileData.empty() || backFileData.empty())
|
if (!fileUtils->isFileExist(leftFileData)
|
||||||
|
|| !fileUtils->isFileExist(rightFileData)
|
||||||
|
|| !fileUtils->isFileExist(upFileData)
|
||||||
|
|| !fileUtils->isFileExist(downFileData)
|
||||||
|
|| !fileUtils->isFileExist(forwardFileData)
|
||||||
|
|| !fileUtils->isFileExist(backFileData))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Skybox* childBox = Skybox::create(leftFileData, rightFileData, upFileData, downFileData, forwardFileData, backFileData);
|
Skybox* childBox = Skybox::create(leftFileData, rightFileData, upFileData, downFileData, forwardFileData, backFileData);
|
||||||
childBox->setCameraMask(cameraFlag);
|
childBox->setCameraMask(cameraFlag);
|
||||||
node->addChild(childBox, 0, "_innerSkyBox");
|
node->addChild(childBox, 0, "_innerSkyBox");
|
||||||
|
|
Loading…
Reference in New Issue