Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fail save if temp file not found

manongjohnc2d5af1b5680
diff --git a/toonz/sources/toonzlib/levelupdater.cpp b/toonz/sources/toonzlib/levelupdater.cpp
index adba49415..1f8ca57ae 100644
--- a/toonz/sources/toonzlib/levelupdater.cpp
+++ b/toonz/sources/toonzlib/levelupdater.cpp
@@ -246,7 +246,8 @@ void LevelUpdater::open(const TFilePath &fp, TPropertyGroup *pg) {
m_lwPath = fp;
}
} catch (...) {
- // In this case, TLevelWriterP(..) failed, that object was never constructed,
+ // In this case, TLevelWriterP(..) failed, that object was never
+ // constructed,
// the assignment m_lw never took place. And m_lw == 0.
// Reset state and rethrow
@@ -442,6 +443,10 @@ void LevelUpdater::close() {
// in Toonz, however :(
m_lr = TLevelReaderP(), m_lw = TLevelWriterP();
+ // A temp file didn't get created. What happened? Force failure!
+ if (!TFileStatus(tempPath).doesExist())
+ throw TSystemException(tempPath, "cant find!");
+
// Rename the level
TSystem::removeFileOrLevel_throw(finalPath);
TSystem::renameFileOrLevel_throw(finalPath,