From 097e7c24817551cc4176c879a18817a4bbe14e46 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Tue, 27 Jun 2023 17:32:00 +0100 Subject: [PATCH] Another stab at resolving weird null error ref #537 --- versioning/versioning.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versioning/versioning.py b/versioning/versioning.py index 47ee7c53..68eb008c 100644 --- a/versioning/versioning.py +++ b/versioning/versioning.py @@ -1,3 +1,4 @@ +import logging from diff_match_patch import diff_match_patch from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist @@ -160,10 +161,9 @@ def item_changes(self): # Build some dicts of what we have item_dict = {} # build a list of items, key is the item_pk for version in old_item_versions: # put all the old versions in a list - old = version._object_version.object - if old is None: - pass - compare = ModelComparison(old=old, **comparisonParams) + if version is None or version._object_version is None: + logging.warning(f"Something was null when it really shouldn't be! {old_item_versions}") + compare = ModelComparison(old=version._object_version.object, **comparisonParams) item_dict[version.object_id] = compare for version in new_item_versions: # go through the new versions