From 64a3b6570d4b16d9d3f163e5df7adeba43a5ed36 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 26 Jan 2016 14:14:12 -0500 Subject: [PATCH] PrimaryObject.get_field(): ignore error on invalid list length --- gramps/gen/lib/primaryobj.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gramps/gen/lib/primaryobj.py b/gramps/gen/lib/primaryobj.py index c3c67bc43..c661cf9ff 100644 --- a/gramps/gen/lib/primaryobj.py +++ b/gramps/gen/lib/primaryobj.py @@ -262,8 +262,14 @@ class BasicPrimaryObject(TableObject, PrivacyBase, TagBase): elif isinstance(current, (list, tuple)): if part.isdigit(): # followed by index, so continue here - current = current[int(part)] - path_to.append(part) + if int(part) < len(current): + current = current[int(part)] + path_to.append(part) + elif ignore_errors: + current = None + keeping_going = False + else: + raise else: # else branch! in middle, split paths for i in range(len(current)): #print("split :", self.__class__.__name__,