From 20663dfa1ce05cdfd0638a2eb65d2622c3398b40 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 12 Sep 2022 15:39:40 -0400 Subject: [PATCH] Add (more) order mode race guards to avoid crashes on "kitty-keys" --- piker/ui/order_mode.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index b97619f3..3f225104 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -260,8 +260,10 @@ class OrderMode: ''' # not initialized yet cursor = self.godw.get_cursor() - chart = cursor.linked.chart + if not cursor: + return + chart = cursor.linked.chart if ( not chart and cursor @@ -271,6 +273,11 @@ class OrderMode: chart = cursor.active_plot price = cursor._datum_xy[1] + if not price: + # zero prices are not supported by any means + # since that's illogical / a no-op. + return + symbol = self.chart.linked.symbol order = self._staged_order = Order(