From a868c997ac37360903401f440cce86e8008fd0c1 Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Sat, 24 Sep 2022 12:58:29 +0200 Subject: [PATCH] Fixed messages attribute --- pyrmv/classes/Leg.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyrmv/classes/Leg.py b/pyrmv/classes/Leg.py index f0c9a9e..3b4c561 100644 --- a/pyrmv/classes/Leg.py +++ b/pyrmv/classes/Leg.py @@ -14,7 +14,7 @@ class Leg(): self.gis = Gis(data["GisRef"]["ref"], data["GisRoute"]) else: self.gis = None - + self.index = data["idx"] self.name = data["name"] self.type = data["type"] @@ -25,8 +25,9 @@ class Leg(): self.direction = None self.messages = [] - for message in data["Messages"]["Message"]: - self.messages.append(Message(message)) + if "Messages" in data: + for message in data["Messages"]["Message"]: + self.messages.append(Message(message)) if "number" in data: self.number = data["number"]