post versions: fix exception when added_tags contains nulls.

Fix exception when viewing old post versions that contain null values in the
added_tags field: https://danbooru.donmai.us/post_versions?search[id]=1319677

There are 82 post versions with nulls in the added_tags fields and 26
with nulls in the removed_tags field.
This commit is contained in:
evazion
2022-09-23 20:04:44 -05:00
parent e5edd79180
commit 9363658652

View File

@@ -6,12 +6,12 @@ module PostVersionsHelper
other = post_version.send(type)
added_tags = post_version.added_tags
added_tags = post_version.added_tags.compact
added_tags << "rating:#{post_version_value(post_version.rating)}" if post_version.rating_changed
added_tags << "parent:#{post_version_value(post_version.parent_id)}" if post_version.parent_changed
added_tags << "source:#{post_version_value(post_version.source)}" if post_version.source_changed
removed_tags = post_version.removed_tags
removed_tags = post_version.removed_tags.compact
if type == "previous" || other.nil?
obsolete_added_tags = []