summaryrefslogtreecommitdiff
path: root/src/bitmap.cpp
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2022-01-29 22:29:06 -0700
committercflip <cflip@cflip.net>2022-01-29 22:29:06 -0700
commit39a045314cb310bc71766e91b34817df5384094c (patch)
treeaa30dd2cf867930547622d2a2ebb6da73a05165c /src/bitmap.cpp
parent07cf257dae91351e5cb6b5a34ffa93c2a3fd8247 (diff)
Close program on image read failure
Diffstat (limited to 'src/bitmap.cpp')
-rw-r--r--src/bitmap.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bitmap.cpp b/src/bitmap.cpp
index 612f2af..a85cceb 100644
--- a/src/bitmap.cpp
+++ b/src/bitmap.cpp
@@ -3,13 +3,16 @@
#define STB_IMAGE_IMPLEMENTATION
#include <stb/stb_image.h>
+#include <iostream>
+
Bitmap::Bitmap(const char* image)
{
int width, height, bitDepth;
uint8_t* buffer = stbi_load(image, &width, &height, &bitDepth, STBI_rgb_alpha);
if (!buffer) {
- return;
+ std::cerr << "Failed to read image from " << image << std::endl;
+ exit(1);
}
this->width = width;