From ba21ad5b52d75c98d15a547a64d246e576c1afc2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 6 Mar 2017 22:55:19 +0300 Subject: Show asserts if any errors happened with fopen. --- src/resources/imagewriter.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/resources') diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp index 4c43e19f3..756cfd6f3 100644 --- a/src/resources/imagewriter.cpp +++ b/src/resources/imagewriter.cpp @@ -24,6 +24,8 @@ #include "logger.h" +#include "utils/checkutils.h" + #include #include @@ -43,7 +45,7 @@ bool ImageWriter::writePNG(SDL_Surface *const surface, nullptr, nullptr, nullptr); if (!png_ptr) { - logger->log1("Had trouble creating png_structp"); + reportAlways("Had trouble creating png_structp"); return false; } @@ -51,21 +53,22 @@ bool ImageWriter::writePNG(SDL_Surface *const surface, if (!info_ptr) { png_destroy_write_struct(&png_ptr, static_cast(nullptr)); - logger->log1("Could not create png_info"); + reportAlways("Could not create png_info"); return false; } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, static_cast(nullptr)); - logger->log("problem writing to %s", filename.c_str()); + reportAlways("problem writing to %s", filename.c_str()); return false; } FILE *const fp = fopen(filename.c_str(), "wb"); if (!fp) { - logger->log("could not open file %s for writing", filename.c_str()); + reportAlways("could not open file %s for writing", + filename.c_str()); return false; } -- cgit v1.2.3-70-g09d2