Avoid application crash on invalid user input

If the user inputs an invalid date this change keeps the application
from crashing when such a date is found. The invalid date
information is reported to the user in the log.

Fixes #12658.
This commit is contained in:
Jon Schewe 2022-07-11 06:50:38 -05:00 committed by Nick Hall
parent bfa7c0c9f4
commit 482199d29c

View File

@ -2873,9 +2873,17 @@ class BasePage: # pylint: disable=C1001
if self.reference_sort:
role = ""
elif role[1:2] == ':':
# format of role is role_type:ISO date string
if role.count(':') > 1:
print("Invalid date :", role[2:], " for individual with ID:", gid,
". Please, use the 'verify the data' tool to correct this.")
cal, role = role.split(':', 1)
else:
cal, role = role.split(':')
# cal is the original calendar
cal, role = role.split(':')
# conver ISO date to Date for translation.
# convert ISO date to Date for translation.
# all modifiers are in english, so convert them
# to the local language
if len(role.split(' - ')) > 1: