From 6e49fe3ae194286f824a26e92f2d90d09931b65d Mon Sep 17 00:00:00 2001 From: Rodney Date: Mar 18 2023 21:35:15 +0000 Subject: Merge pull request #4786 from justburner/Patch4479 Fix crash when trying to paste a level with no palette --- diff --git a/toonz/sources/common/tvrender/tpalette.cpp b/toonz/sources/common/tvrender/tpalette.cpp index 6c271f4..b2cbdc4 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 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 Image for (auto const &image : usedImageSet) {