OpenToonz - An open-source full-featured 2D animation creation software
C
Fix to stop creating zero-size image (#333)
Keisuke Ogakicd46cc83624c
diff --git a/toonz/sources/image/tzl/tiio_tzl.cpp b/toonz/sources/image/tzl/tiio_tzl.cppindex bd2aea3e8..90337eac0 100644--- a/toonz/sources/image/tzl/tiio_tzl.cpp+++ b/toonz/sources/image/tzl/tiio_tzl.cpp@@ -2116,7 +2116,6 @@ TImageP TImageReaderTzl::load14()throw TException("Loading tlv: bad icon size.");fread(&actualBuffSize, sizeof(TINT32), 1, chan);- assert(actualBuffSize > 0 && actualBuffSize <= (int)(iconLx * iconLx * sizeof(TPixelCM32)));if (actualBuffSize <= 0 || actualBuffSize > (int)(iconLx * iconLx * sizeof(TPixelCM32)))throw TException("Loading tlv: icon buffer size error.");@@ -2210,8 +2209,6 @@ TImageP TImageReaderTzl::load14()ti->setPalette(m_lrp->m_level->getPalette());return ti;}-- assert(actualBuffSize > 0 && actualBuffSize <= (int)(m_lx * m_ly * sizeof(TPixelCM32)));if (actualBuffSize <= 0 || actualBuffSize > (int)(m_lx * m_ly * sizeof(TPixelCM32)))throw TException("Loading tlv: buffer size error");diff --git a/toonz/sources/toonz/levelcreatepopup.cpp b/toonz/sources/toonz/levelcreatepopup.cppindex b309b5e2b..254e2b7a5 100644--- a/toonz/sources/toonz/levelcreatepopup.cpp+++ b/toonz/sources/toonz/levelcreatepopup.cpp@@ -392,7 +392,8 @@ bool LevelCreatePopup::apply()double w = m_widthFld->getValue();double h = m_heightFld->getValue();double dpi = m_dpiFld->getValue();- int xres = tround(w * dpi), yres = tround(h * dpi);+ int xres = std::max(tround(w * dpi), 1);+ int yres = std::max(tround(h * dpi), 1);int lType = getLevelType();std::wstring levelName = m_nameFld->text().toStdWString();