From 33f2d64cddf66a430b650133dbf2c467305b463f Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 18 Feb 2011 01:12:34 +0000 Subject: [PATCH] Protection around .next() when there is no next svn: r16660 --- src/cli/plug/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cli/plug/__init__.py b/src/cli/plug/__init__.py index 516a79352..fbd7aa77a 100644 --- a/src/cli/plug/__init__.py +++ b/src/cli/plug/__init__.py @@ -89,7 +89,10 @@ def _validate_options(options, dbase): if not person: person = dbase.get_default_person() if not person: - phandle = dbase.iter_person_handles().next() + try: + phandle = dbase.iter_person_handles().next() + except StopIteration: + phandle = None person = dbase.get_person_from_handle(phandle) if not person: print "ERROR: Please specify a person" @@ -108,7 +111,10 @@ def _validate_options(options, dbase): if family_list: family_handle = family_list[0] else: - family_handle = dbase.iter_family_handles().next() + try: + family_handle = dbase.iter_family_handles().next() + except StopIteration: + family_handle = None if family_handle: family = dbase.get_family_from_handle(family_handle) option.set_value(family.get_gramps_id())