fix (pre-emptive): Guard against null/empty prices in LadderRender

This commit is contained in:
John Colvin committed 2023-07-25 14:27:13 -04:00
1 parent da927adef4
commit 4bf237aebe
1 file changed
+2 -1
@@ -371,8 +371,9 @@ namespace mbts.spark {
static void _render_cells<T>(DrawingVisual dv, double row_height, IEnumerable<(double price, T value)> data, LadderColumnSettings settings, IList<double> prices, RegionalTickFactors spec, RenderCell<T> render_cell) {
using (var dc = dv.RenderOpen())
using (_draw_with_clip(dc, settings, row_height, prices.Count)) {
if (data.is_null_or_empty())
if (prices.is_null_or_empty() || data.is_null_or_empty()) {
return;
}
var min_price = prices[prices.Count - 1];
var max_price = prices[0];
Log.assert(min_price.is_real() && max_price.is_real() && min_price <= max_price);