check for null FILE pointer after trying to create the MESH file
This commit is contained in:
parent
e0996a381d
commit
5b7f26aeaa
|
@ -294,6 +294,8 @@ bool Md2::Load(const std::string &file)
|
||||||
bool Md2::ConvertToMesh(const std::string &file)
|
bool Md2::ConvertToMesh(const std::string &file)
|
||||||
{
|
{
|
||||||
FILE *fp = fopen(file.c_str(), "wb");
|
FILE *fp = fopen(file.c_str(), "wb");
|
||||||
|
if (fp == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
fputs("MESH", fp);
|
fputs("MESH", fp);
|
||||||
unsigned char version = 1;
|
unsigned char version = 1;
|
||||||
|
|
|
@ -209,5 +209,14 @@ bool StaticModel::Load(const std::string &file, const std::string &texturePath)
|
||||||
|
|
||||||
bool StaticModel::ConvertToMesh(const std::string &file)
|
bool StaticModel::ConvertToMesh(const std::string &file)
|
||||||
{
|
{
|
||||||
|
FILE *fp = fopen(file.c_str(), "wb");
|
||||||
|
if (fp == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
fputs("MESH", fp);
|
||||||
|
unsigned char version = 1;
|
||||||
|
fwrite(&version, 1, 1, fp);
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue