From b527a2d3149fad63511c8380c66e17ae4a4ea02a Mon Sep 17 00:00:00 2001 From: manongjohn <19245851+manongjohn@users.noreply.github.com> Date: Sun, 27 Nov 2022 12:07:54 -0500 Subject: [PATCH] Fix MeshImage compression crash --- toonz/sources/common/tcache/timagecache.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/toonz/sources/common/tcache/timagecache.cpp b/toonz/sources/common/tcache/timagecache.cpp index 9320a52d..b88d1293 100644 --- a/toonz/sources/common/tcache/timagecache.cpp +++ b/toonz/sources/common/tcache/timagecache.cpp @@ -19,6 +19,7 @@ #include "timagecache.h" #include "trasterimage.h" +#include "tmeshimage.h" #ifndef TNZCORE_LIGHT #include "tvectorimage.h" #include "trastercm.h" @@ -437,7 +438,7 @@ CompressedOnMemoryCacheItem::~CompressedOnMemoryCacheItem() { //------------------------------------------------------------------------------ TUINT32 CompressedOnMemoryCacheItem::getSize() const { - if (m_compressedRas) + if (m_compressedRas && m_compressedRas.getPointer()) return m_compressedRas->getLx(); else return 0; @@ -1239,7 +1240,8 @@ void TImageCache::Imp::add(const std::string &id, const TImageP &img, #ifdef TNZCORE_LIGHT item->m_cantCompress = false; #else - item->m_cantCompress = (TVectorImageP(img) ? true : false); + item->m_cantCompress = + (TVectorImageP(img) || TMeshImageP(img) ? true : false); #endif item->m_id = id; m_uncompressedItems[id] = item;