From 43da1dab3aa5df7dc79ba8b7544e33e1c9dfe44d Mon Sep 17 00:00:00 2001 From: Kip Yin <28321392+kipyin@users.noreply.github.com> Date: Mon, 4 Feb 2019 15:47:52 +0800 Subject: [PATCH] Fix StopIteration causing program termination --- pokedex/db/translations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pokedex/db/translations.py b/pokedex/db/translations.py index 8f55473..67c793a 100755 --- a/pokedex/db/translations.py +++ b/pokedex/db/translations.py @@ -377,7 +377,10 @@ def group_by_object(stream): Yields ((class name, object ID), (list of messages)) pairs. """ stream = iter(stream) - current = next(stream) + try: + current = next(stream) + except StopIteration: + yield StopIteration current_key = current.cls, current.id group = [current] for message in stream: