Fix IsEnclosedBy rule for non-existent places

This commit is contained in:
Nick Hall 2015-06-28 19:11:42 +01:00
parent 01536e4b50
commit 0ad17ac27f

View File

@ -51,9 +51,14 @@ class IsEnclosedBy(Rule):
category = _('General filters') category = _('General filters')
def prepare(self, db): def prepare(self, db):
self.handle = db.get_place_from_gramps_id(self.list[0]).handle self.handle = None
place = db.get_place_from_gramps_id(self.list[0])
if place:
self.handle = place.handle
def apply(self, db, place): def apply(self, db, place):
if self.handle is None:
return False
if located_in(db, place.handle, self.handle): if located_in(db, place.handle, self.handle):
return True return True
return False return False