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)
This commit is contained in:
John Colvin committed 2023-11-02 14:15:58 -04:00
1 parent 13251f5c06
commit a81dc8ec7f
1 file changed
+1 -1
@@ -87,7 +87,7 @@ namespace mbts.spark {
length = _initial_row_count,
};
LadderPriceList _pending_price_list = null;
IComparer<double> _price_comparer;
IComparer<double> _price_comparer = MathUtils.epsilon_comparer.reverse();
double _last_origin_price;
readonly MarketBreakLines _mkt_break_lines;
NativePriceSize _last_trade;