mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-07-04 21:25:11 +08:00
Return false for zero-sized asset. Fixes #255
This commit is contained in:
parent
925b83627a
commit
73c4cce303
@ -2592,11 +2592,12 @@ bool ReadWholeFile(std::vector<unsigned char> *out, std::string *err,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
size_t size = AAsset_getLength(asset);
|
size_t size = AAsset_getLength(asset);
|
||||||
if (size <= 0) {
|
if (size == 0) {
|
||||||
if (err) {
|
if (err) {
|
||||||
(*err) += "Invalid file size : " + filepath +
|
(*err) += "Invalid file size : " + filepath +
|
||||||
" (does the path point to a directory?)";
|
" (does the path point to a directory?)";
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
out->resize(size);
|
out->resize(size);
|
||||||
AAsset_read(asset, reinterpret_cast<char *>(&out->at(0)), size);
|
AAsset_read(asset, reinterpret_cast<char *>(&out->at(0)), size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user