From d24becd052e260d9895f46a8672d890dd6c387af Mon Sep 17 00:00:00 2001 From: John Colvin Date: Thu, 2 Nov 2023 14:13:59 -0400 Subject: [PATCH] fix: Ensure LadderGridHost's price_comparer isn't null Initialize it w/ reasonable default when LadderGridHost is constructed. Bugs (fixed): * Sometimes the OrderBook's ladder panel throws a null ref ex when the orders collection changes Cause: The orders collection changed callback references the ladder's price_comparer, which may be null since it isn't initialized until the DataContextChanged event fires (the relative order of these events is non-deterministic) --- src/client/spark/Modules/Trading/Ladder/View/LadderGridHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/spark/Modules/Trading/Ladder/View/LadderGridHost.cs b/src/client/spark/Modules/Trading/Ladder/View/LadderGridHost.cs index 75bed40e5..1eb64dd7a 100644 --- a/src/client/spark/Modules/Trading/Ladder/View/LadderGridHost.cs +++ b/src/client/spark/Modules/Trading/Ladder/View/LadderGridHost.cs @@ -87,7 +87,7 @@ namespace mbts.spark { length = _initial_row_count, }; LadderPriceList _pending_price_list = null; - IComparer _price_comparer; + IComparer _price_comparer = MathUtils.epsilon_comparer.reverse(); double _last_origin_price; readonly MarketBreakLines _mkt_break_lines; NativePriceSize _last_trade;