Issue #1397: File contents are now kept if load fails, add "no pages" loading error

The "Rephrase error message (thanks to Technius!)" commit on the issue_1397_archive branch is included in this PR.
Because that change is minor, I squashed everything into 1 commit.
presentation
siliconninja 7 years ago
parent a6276cd295
commit ca639a6913
  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