aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/image/art.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword25/gfx/image/art.h')
-rw-r--r--engines/sword25/gfx/image/art.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/sword25/gfx/image/art.h b/engines/sword25/gfx/image/art.h
index bfeb31cc30..8c9c97bc57 100644
--- a/engines/sword25/gfx/image/art.h
+++ b/engines/sword25/gfx/image/art.h
@@ -51,10 +51,13 @@ namespace Sword25 {
#define art_expand(p, type, max) \
do { \
if(max) {\
- p = art_renew(p, type, max <<= 1); \
+ type *tmp = art_renew(p, type, max <<= 1); \
+ if (!tmp) error("Cannot reallocate memory for art data"); \
+ p = tmp; \
} else { \
max = 1; \
p = art_new(type, 1); \
+ if (!p) error("Cannot allocate memory for art data"); \
} \
} while (0)