diff --git a/src/client/spark/view/Spark/Ladder/LadderGridHost.cs b/src/client/spark/view/Spark/Ladder/LadderGridHost.cs index e137ad3f1..c15b706f2 100644 --- a/src/client/spark/view/Spark/Ladder/LadderGridHost.cs +++ b/src/client/spark/view/Spark/Ladder/LadderGridHost.cs @@ -153,8 +153,10 @@ namespace mbts.spark { internal double price_for_point(Point point) => _price_for_row(_row_for_point(point)); - static ushort? _size_from_row(int row, double[] price_list, NativePriceSize[] depth, ContractSpecificationImmutable spec) => - row <= price_list.Length ? _size_from_price(price_list[row], depth, spec) : null; + static ushort? _size_from_row(int row, double[] price_list, NativePriceSize[] depth, ContractSpecificationImmutable spec) { + if (price_list == null) return null; + else return row <= price_list.Length ? _size_from_price(price_list[row], depth, spec) : null; + } static ushort? _size_from_price(double price, NativePriceSize[] depth, ContractSpecificationImmutable spec) => depth.FirstOrDefault(nps => spec.tick_equals(price, nps.price), nps => new ushort?(nps.size)); @@ -164,7 +166,9 @@ namespace mbts.spark { var click_offset = point.Y / _settings.row_height; return (int)(row_offset + click_offset); } - double _price_for_row(int row) => _price_list == null ? double.NaN : _price_list[row]; + + double _price_for_row(int row) => + _price_list == null ? double.NaN : _price_list[row]; ushort? _bid_size_from_row(int row) => _size_from_row(row, _price_list, _bids, _vm.security.ContractSpec);