From 3cc28bcfc63369013f8c24a4cf07a13fb54c86dc Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Mon, 13 Apr 2026 15:36:28 +0300 Subject: Handle an error --- bmp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bmp.c b/bmp.c index abc0db5..33dd7dc 100644 --- a/bmp.c +++ b/bmp.c @@ -93,6 +93,10 @@ void map_to_bmp(Map map, size_t map_width, size_t map_height, Position start, Po FILE *fout = fopen(filename, "wb"); + if (fout == NULL) { + message(height, "Couldn't open %s for writing", filename); + return; + } fwrite(header, 1, 54, fout); fwrite((char*)buf, 1, imagesize, fout); fclose(fout); -- cgit v1.2.3