diff --git a/src/client/spark/view/Spark/Ladder/LadderGridHost.cs b/src/client/spark/view/Spark/Ladder/LadderGridHost.cs index 5d3b8a13a..1e6447924 100644 --- a/src/client/spark/view/Spark/Ladder/LadderGridHost.cs +++ b/src/client/spark/view/Spark/Ladder/LadderGridHost.cs @@ -127,8 +127,8 @@ namespace mbts.spark { protected override async void OnMouseDown(MouseButtonEventArgs e) { Keyboard.ClearFocus(); Focus(); - if(e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed) - _scroll_to_center(); + if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed) + _scroll_to_center(); else if (_settings != null && !_tactile_adorner.is_resizing_column) { var point = e.GetPosition(this); var price = price_for_point(point); @@ -164,8 +164,9 @@ namespace mbts.spark { } static ushort? _size_from_price(double price, NativePriceSize[] depth, ContractSpecificationImmutable spec) { - if (double.IsNaN(price)) return null; - else return depth.FirstOrDefault(nps => spec.tick_equals(price, nps.price), nps => nps.size); + if (!double.IsNaN(price) && depth.TryGetFirst(nps => spec.tick_equals(price, nps.price), out NativePriceSize result)) + return result.size; + return null; } int _row_for_point(Point point) {