OpenToonz - An open-source full-featured 2D animation creation software
C
Fix crash when trying to paste a level with no palette
justburner85c12a29a346
diff --git a/toonz/sources/common/tvrender/tpalette.cpp b/toonz/sources/common/tvrender/tpalette.cppindex 6c271f40e..b2cbdc4c0 100644--- a/toonz/sources/common/tvrender/tpalette.cpp+++ b/toonz/sources/common/tvrender/tpalette.cpp@@ -904,7 +904,7 @@ void TPalette::loadData(TIStream &is) {* original names.*/void TPalette::assign(const TPalette *src, bool isFromStudioPalette) {- if (src == this) return;+ if (!src || src == this) return;int i;m_isCleanupPalette = src->isCleanupPalette();// for(i=0;i<getStyleCount();i++) delete getStyle(i);diff --git a/toonz/sources/toonz/drawingdata.cpp b/toonz/sources/toonz/drawingdata.cppindex afcc09921..b621367a1 100644--- a/toonz/sources/toonz/drawingdata.cpp+++ b/toonz/sources/toonz/drawingdata.cpp@@ -308,7 +308,9 @@ bool DrawingData::getLevelFrames(TXshSimpleLevel *sl,bool styleAdded = mergePalette_Overlap(slPlt, imgPlt, keepOriginalPalette);std::map<int, int> styleTable;- for (int s = 0; s < slPlt->getStyleCount(); s++) styleTable[s] = s;+ if (slPlt) {+ for (int s = 0; s < slPlt->getStyleCount(); s++) styleTable[s] = s;+ }// Merge Imagefor (auto const &image : usedImageSet) {