diff --git a/src/AutoRecovery.cpp b/src/AutoRecovery.cpp index 9711d7de0..b04997618 100755 --- a/src/AutoRecovery.cpp +++ b/src/AutoRecovery.cpp @@ -694,10 +694,21 @@ bool AutoSaveFile::Decode(const wxString & fileName) // Decode to a temporary file to preserve the orignal. wxString tempName = fn.CreateTempFileName(fn.GetPath()); + bool opened = false; + XMLFileWriter out; - out.Open(tempName, wxT("wb")); - if (!out.IsOpened()) + try + { + out.Open(tempName, wxT("wb")); + opened = out.IsOpened(); + } + catch (XMLFileWriterException* pException) + { + delete pException; + } + + if (!opened) { delete[] buf;