From fa33d42fe2eae25a3c8b03788898697cf3496175 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Thu, 30 May 2019 20:18:40 +0200 Subject: [PATCH] Can't pop dictionary keys while looping --- nw/project/index.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nw/project/index.py b/nw/project/index.py index b08ed313..5ad504b6 100644 --- a/nw/project/index.py +++ b/nw/project/index.py @@ -152,9 +152,12 @@ class NWIndex(): isNovel = False # Also clear references to file in tag index + clearTags = [] for aTag in self.tagIndex: if self.tagIndex[aTag][1] == tHandle: - self.tagIndex.pop(aTag) + clearTags.append(aTag) + for aTag in clearTags: + self.tagIndex.pop(aTag) nLine = 0 for aLine in theText.splitlines():