Fix bug where split document loses status or importance

This commit is contained in:
Veronica Berglyd Olsen
2022-10-30 17:07:24 +01:00
parent 1784d9ce28
commit c1988bcc17
+5 -1
View File
@@ -192,7 +192,7 @@ class DocSplitter:
"""An iterator that will write each document in the buffer, and
return its new handle, parent handle, and sibling handle.
"""
if self._srcHandle is None:
if self._srcHandle is None or self._srcItem is None:
return
pHandle = self._parHandle
@@ -224,6 +224,10 @@ class DocSplitter:
dHandle = self.theProject.newFile(docLabel, pHandle)
hHandle[hLevel] = dHandle
newItem = self.theProject.tree[dHandle]
newItem.setStatus(self._srcItem.itemStatus)
newItem.setImport(self._srcItem.itemImport)
outDoc = NWDoc(self.theProject, dHandle)
status = outDoc.writeDocument("\n".join(docText))
if not status: