From 86e606a22e527b058b2dea3a9c3508cbbbafe0e6 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 9 Sep 2023 00:45:33 +0200 Subject: [PATCH] make sure we are working with the right type --- owrx/adsb/modes.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/owrx/adsb/modes.py b/owrx/adsb/modes.py index 9fc37c8b..802f553a 100644 --- a/owrx/adsb/modes.py +++ b/owrx/adsb/modes.py @@ -30,9 +30,13 @@ class AdsbLocation(IncrementalUpdate, AirplaneLocation): super().__init__(message) def update(self, previousLocation: Location): - history = previousLocation.history - now = datetime.now() - history = [p for p in history if now - p["timestamp"] < self.getTTL()] + if isinstance(previousLocation, AdsbLocation): + history = previousLocation.history + now = datetime.now() + history = [p for p in history if now - p["timestamp"] < self.getTTL()] + else: + history = [] + history += [{ "timestamp": self.timestamp, "props": self.props,