diff options
author | cflip <cflip@cflip.net> | 2022-01-29 22:29:06 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2022-01-29 22:29:06 -0700 |
commit | 39a045314cb310bc71766e91b34817df5384094c (patch) | |
tree | aa30dd2cf867930547622d2a2ebb6da73a05165c /src/bitmap.cpp | |
parent | 07cf257dae91351e5cb6b5a34ffa93c2a3fd8247 (diff) |
Close program on image read failure
Diffstat (limited to 'src/bitmap.cpp')
-rw-r--r-- | src/bitmap.cpp | 5 |
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; |