Bug fix : Program crashed when on-screen result items were defined for the first time on a PC (columnWidths == null).

This commit is contained in:
Milan Hanajik
2019-09-23 07:17:42 +02:00
parent 9caae8dffd
commit 179735fcd1
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -90,11 +90,11 @@ namespace Results.Forms
#endif #endif
/// Header /// Header
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40); lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
int col = 1; int col = 1;
foreach (var str in wMtr.GetAllDecoratedTestNames()) foreach (var str in wMtr.GetAllDecoratedTestNames())
{ {
lView.Columns.Add(str, (columnWidths.Length > col) ? columnWidths[col] : 70); lView.Columns.Add(str, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
col++; col++;
} }
+2 -2
View File
@@ -67,13 +67,13 @@ namespace Results.Forms
/// Always draw ListView header /// Always draw ListView header
lView.Columns.Clear(); lView.Columns.Clear();
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40); lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
if (items == null || items.Count == 0) return; if (items == null || items.Count == 0) return;
int col = 1; int col = 1;
foreach (var item in items) foreach (var item in items)
{ {
lView.Columns.Add(item.Caption, (columnWidths.Length > col) ? columnWidths[col] : 70); lView.Columns.Add(item.Caption, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
col++; col++;
} }
} }