summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/geometry/sprite_atlas.cpp1
-rw-r--r--src/map/sprite.cpp3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/geometry/sprite_atlas.cpp b/src/geometry/sprite_atlas.cpp
index 5271122919..e5bad1eada 100644
--- a/src/geometry/sprite_atlas.cpp
+++ b/src/geometry/sprite_atlas.cpp
@@ -158,6 +158,7 @@ void SpriteAtlas::allocate() {
void SpriteAtlas::copy(const Rect<dimension>& dst, const SpritePosition& src) {
if (!sprite->raster) return;
const uint32_t *src_img = reinterpret_cast<const uint32_t *>(sprite->raster->getData());
+ if (!src_img) return;
allocate();
uint32_t *dst_img = reinterpret_cast<uint32_t *>(data);
diff --git a/src/map/sprite.cpp b/src/map/sprite.cpp
index 876586e4b0..ad1a8e770b 100644
--- a/src/map/sprite.cpp
+++ b/src/map/sprite.cpp
@@ -102,6 +102,9 @@ bool Sprite::isLoaded() const {
void Sprite::parseImage() {
raster = std::make_unique<util::Image>(image);
+ if (!*raster) {
+ raster.reset();
+ }
image.clear();
loadedImage = true;
}