about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/engine/client/graphics.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp
index 87cabd08..14a88394 100644
--- a/src/engine/client/graphics.cpp
+++ b/src/engine/client/graphics.cpp
@@ -393,10 +393,12 @@ int CGraphics_OpenGL::LoadPNG(CImageInfo *pImg, const char *pFilename)
 		return 0;
 	}
 	
-	if(png_open_file(&Png, aCompleteFilename) != PNG_NO_ERROR) // ignore_convention
+	int Error = png_open_file(&Png, aCompleteFilename); // ignore_convention
+	if(Error != PNG_NO_ERROR)
 	{
 		dbg_msg("game/png", "failed to open file. filename='%s'", aCompleteFilename);
-		png_close_file(&Png); // ignore_convention
+		if(Error != PNG_FILE_ERROR)
+			png_close_file(&Png); // ignore_convention
 		return 0;
 	}