From 53e290644ccd51c9413183da9a0f796fb5177aab Mon Sep 17 00:00:00 2001
From: jabarrera <jabarrera@users.noreply.github.com>
Date: Feb 27 2017 05:24:11 +0000
Subject: Checks data sound is valid to save. Issue #957 (#971)


close #957 
---

diff --git a/toonz/sources/sound/aiff/tsio_aiff.cpp b/toonz/sources/sound/aiff/tsio_aiff.cpp
index ba04c99..b27f122 100644
--- a/toonz/sources/sound/aiff/tsio_aiff.cpp
+++ b/toonz/sources/sound/aiff/tsio_aiff.cpp
@@ -457,7 +457,9 @@ TSoundTrackWriterAiff::TSoundTrackWriterAiff(const TFilePath &fp)
 //------------------------------------------------------------------------------
 
 bool TSoundTrackWriterAiff::save(const TSoundTrackP &st) {
-  assert(st);
+  if (!st)
+    throw TException(L"Unable to save the soundtrack: " +
+                     m_path.getWideString());
 
   TSoundTrackP sndtrack;
   if (st->getBitPerSample() == 8 && !st->isSampleSigned())
diff --git a/toonz/sources/toonzlib/sceneresources.cpp b/toonz/sources/toonzlib/sceneresources.cpp
index 5d73d42..0a9b611 100644
--- a/toonz/sources/toonzlib/sceneresources.cpp
+++ b/toonz/sources/toonzlib/sceneresources.cpp
@@ -14,6 +14,8 @@
 #include "toonz/preferences.h"
 #include "tpalette.h"
 
+#include "tmsgcore.h"
+
 #include "tconvert.h"
 #include "tlogger.h"
 #include "tsystem.h"
@@ -429,7 +431,8 @@ void SceneSound::save() {
       TSystem::copyFile(actualFp, m_oldActualPath);
     }
   } catch (...) {
-    TLogger::error() << "Can't save " << actualFp;
+    DVGui::warning(QObject::tr("Can't save") +
+                   QString::fromStdWString(L": " + actualFp.getLevelNameW()));
   }
 }