mirror of https://github.com/axmolengine/axmol.git
add check data valid in getStringFromFile
so far no check would be crashed when getData faild. maybe return an empty string is better.
This commit is contained in:
parent
e5aaed49cf
commit
8fac676a82
|
@ -547,6 +547,8 @@ static Data getData(const std::string& filename, bool forString)
|
|||
std::string FileUtils::getStringFromFile(const std::string& filename)
|
||||
{
|
||||
Data data = getData(filename, true);
|
||||
if (! data.getBytes())
|
||||
return "";
|
||||
std::string ret((const char*)data.getBytes());
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue