diff options
Diffstat (limited to 'intern/cycles/device/device_memory.h')
-rw-r--r-- | intern/cycles/device/device_memory.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/intern/cycles/device/device_memory.h b/intern/cycles/device/device_memory.h index ba79f8c88ae..8c32d03135e 100644 --- a/intern/cycles/device/device_memory.h +++ b/intern/cycles/device/device_memory.h @@ -211,7 +211,10 @@ public: T *resize(size_t width, size_t height = 0, size_t depth = 0) { data_size = width * ((height == 0)? 1: height) * ((depth == 0)? 1: depth); - data.resize(data_size); + if(data.resize(data_size) == NULL) { + clear(); + return NULL; + } data_width = width; data_height = height; data_depth = depth; @@ -226,7 +229,9 @@ public: T *copy(T *ptr, size_t width, size_t height = 0, size_t depth = 0) { T *mem = resize(width, height, depth); - memcpy(mem, ptr, memory_size()); + if(mem != NULL) { + memcpy(mem, ptr, memory_size()); + } return mem; } |