mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
dilate: Don't crash if file doesn't exist
This commit is contained in:
parent
a4025a37d4
commit
80b7ceb3d7
|
@ -54,7 +54,14 @@ int DilateFile(const char *pFileName)
|
|||
CPixel *pBuffer[3] = {0,0,0};
|
||||
|
||||
png_init(0, 0);
|
||||
png_open_file(&Png, pFileName);
|
||||
int Error = png_open_file(&Png, pFileName);
|
||||
if(Error != PNG_NO_ERROR)
|
||||
{
|
||||
dbg_msg("dilate", "failed to open image file. filename='%s'", pFileName);
|
||||
if(Error != PNG_FILE_ERROR)
|
||||
png_close_file(&Png);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(Png.color_type != PNG_TRUECOLOR_ALPHA)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue