aboutsummaryrefslogtreecommitdiff
path: root/bmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'bmp.c')
-rw-r--r--bmp.c4
1 files changed, 4 insertions, 0 deletions
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);