Merge pull request #1399 from siliconninja/issue_1397

Issue #1397: File contents are now kept if load fails, add "no pages" loading error
presentation
Bryan Tan 7 years ago committed by GitHub
commit 3a4be0a255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/control/Control.cpp
  2. 5
      src/control/xojfile/LoadHandler.cpp

@ -2316,8 +2316,6 @@ bool Control::openFile(Path filename, int scrollToPage, bool forceOpen)
}
}
this->closeDocument();
// Read template file
if (filename.hasExtension(".xopt"))
{
@ -2381,6 +2379,8 @@ bool Control::openFile(Path filename, int scrollToPage, bool forceOpen)
}
else
{
this->closeDocument();
this->doc->lock();
this->doc->clearDocument();
*this->doc = *loadedDocument;

@ -298,6 +298,11 @@ bool LoadHandler::parseXml()
lastError = _("Document is not complete (maybe the end is cut off?)");
return false;
}
else if (this->pos == PASER_POS_FINISHED && this->doc.getPageCount() == 0)
{
lastError = _("Document is corrupted (no pages found in file)");
return false;
}
doc.setCreateBackupOnSave(this->fileVersion >= 3);

Loading…
Cancel
Save