diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-03 19:31:45 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-03 19:31:45 +0400 |
commit | da8f71bffb1a33c695a368c1243b8aa9ac54c21d (patch) | |
tree | 988f91e51c03a676fef598ce1e9b03f245244c0a /intern/cycles/util | |
parent | 590b7ff102c0ac5ee1f45ef8e43664afd9131251 (diff) |
Cycles: some tweaks to silence msvc assertions in debug mode.
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_cache.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/intern/cycles/util/util_cache.h b/intern/cycles/util/util_cache.h index 25b1f2e7a51..91e8a94a584 100644 --- a/intern/cycles/util/util_cache.h +++ b/intern/cycles/util/util_cache.h @@ -57,20 +57,26 @@ public: template<typename T> void add(const vector<T>& data) { - CacheBuffer buffer(&data[0], data.size()*sizeof(T)); - buffers.push_back(buffer); + if(data.size()) { + CacheBuffer buffer(&data[0], data.size()*sizeof(T)); + buffers.push_back(buffer); + } } template<typename T> void add(const array<T>& data) { - CacheBuffer buffer(&data[0], data.size()*sizeof(T)); - buffers.push_back(buffer); + if(data.size()) { + CacheBuffer buffer(&data[0], data.size()*sizeof(T)); + buffers.push_back(buffer); + } } void add(void *data, size_t size) { - CacheBuffer buffer(data, size); - buffers.push_back(buffer); + if(size) { + CacheBuffer buffer(data, size); + buffers.push_back(buffer); + } } void add(int& data) @@ -94,6 +100,9 @@ public: return; } + if(!size) + return; + data.resize(size/sizeof(T)); if(!fread(&data[0], size, 1, f)) { |