LadderGridHost - avoid index-out-of-range ex if _column_for_point is called before columns are set

This commit is contained in:
John Colvin committed 2018-09-02 14:33:09 -04:00
1 parent 4447412e64
commit 76a519911d
1 file changed
+1 -1
@@ -271,7 +271,7 @@ namespace mbts.spark {
#region Column Utility Methods
Column _column_for_point(Point point) =>
columns.FirstOrDefault(c => c.x_right > point.X, columns[columns.Length - 1]);
columns.FirstOrDefault(c => c.x_right > point.X, columns.Length > 0 ? columns[columns.Length - 1] : Column.Empty);
double _column_start(ColumnType col_type) =>
columns.TakeWhile(c => c.column_type != col_type).Sum(c => c.settings.width);