diff --git a/VocaluxeLib/Songs/CSongWriter.cs b/VocaluxeLib/Songs/CSongWriter.cs index a36e3fe6..a458fd70 100644 --- a/VocaluxeLib/Songs/CSongWriter.cs +++ b/VocaluxeLib/Songs/CSongWriter.cs @@ -177,11 +177,21 @@ namespace VocaluxeLib.Songs _WriteHeader(); _WriteNotes(); } + catch (UnauthorizedAccessException) + { + CBase.Log.LogError("Cannot write " + filePath + ". Directory might be readonly or requires admin rights."); + return false; + } catch (Exception e) { CBase.Log.LogError("Unhandled exception while writing " + filePath + ": " + e); return false; } + finally + { + if (_Tw != null) + _Tw.Dispose(); + } return true; } }