Fixed crash when you selected the Open button on the Library Document tab in the Tools panel. Open button is only available for library documents with zero references.

If the open library document is not referenced, then save changes but don’t generate a PDF.
This commit is contained in:
2016-05-26 15:25:47 +00:00
parent 008a1e67eb
commit f763a9a868
3 changed files with 14 additions and 7 deletions

View File

@@ -413,11 +413,14 @@ namespace Volian.Controls.Library
_MyLog.FatalFormat("File does not exist {0}\r\nFile was {1}", tmp, MyDSOFile.FullName);
// if this was a library document, ask user if it should be saved for all usages.
bool cvtLibDoc = false;
EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry;
if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "")
if (MyDisplayTabItem.MyItemInfo != null) // B2016-131 if myiteminfo is null then the lib doc is not referenced, so just save the changes - don't generate a pdf
{
DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo);
if (ans == DialogResult.No) cvtLibDoc = true;
EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry;
if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "")
{
DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo);
if (ans == DialogResult.No) cvtLibDoc = true;
}
}
MyDSOFile.SaveFile(doc.Length, doc.Ascii, MyDisplayTabItem.MyItemInfo, cvtLibDoc, StatusChanged);
if (cvtLibDoc)