mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[cocos2d-x] Closes #472, fail gracefully if file is not found
This commit is contained in:
parent
f4f4c3ee91
commit
1c192cc3fb
@ -77,6 +77,7 @@ void _spAtlasPage_disposeTexture (spAtlasPage* self) {
|
|||||||
char* _spUtil_readFile (const char* path, int* length) {
|
char* _spUtil_readFile (const char* path, int* length) {
|
||||||
Data data = FileUtils::getInstance()->getDataFromFile(
|
Data data = FileUtils::getInstance()->getDataFromFile(
|
||||||
FileUtils::getInstance()->fullPathForFilename(path).c_str());
|
FileUtils::getInstance()->fullPathForFilename(path).c_str());
|
||||||
|
if (data.isNull()) return 0;
|
||||||
*length = data.getSize();
|
*length = data.getSize();
|
||||||
char* bytes = MALLOC(char, *length);
|
char* bytes = MALLOC(char, *length);
|
||||||
memcpy(bytes, data.getBytes(), *length);
|
memcpy(bytes, data.getBytes(), *length);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user