From c40ace129046a9760967ecb8d6d8f540dbc82f4c Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Wed, 19 Oct 2022 00:04:31 +0200 Subject: [PATCH] Fix a few weird dictionary lookups in the index --- novelwriter/core/index.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/novelwriter/core/index.py b/novelwriter/core/index.py index 24e38097..3c8c1fd7 100644 --- a/novelwriter/core/index.py +++ b/novelwriter/core/index.py @@ -668,23 +668,17 @@ class TagsIndex: def tagHandle(self, tagKey): """Get the handle of a given tag. """ - if tagKey in self._tags: - return self._tags.get(tagKey).get("handle") - return None + return self._tags.get(tagKey, {}).get("handle", None) def tagHeading(self, tagKey): """Get the heading of a given tag. """ - if tagKey in self._tags: - return self._tags.get(tagKey).get("heading") - return nwHeaders.TT_NONE + return self._tags.get(tagKey, {}).get("heading", nwHeaders.TT_NONE) def tagClass(self, tagKey): """Get the class of a given tag. """ - if tagKey in self._tags: - return self._tags.get(tagKey).get("class") - return None + return self._tags.get(tagKey, {}).get("class", None) ## # Pack/Unpack