diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index e6add2e6e..160b8d696 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -551,15 +551,17 @@ namespace Terminal.Gui { /// public ListWrapper (IList source) { - count = source.Count; - marks = new BitArray (count); - this.src = source; + if (source != null) { + count = source.Count; + marks = new BitArray (count); + this.src = source; + } } /// /// Gets the number of items in the . /// - public int Count => src.Count; + public int Count => Convert.ToInt32 (src?.Count); void RenderUstr (ConsoleDriver driver, ustring ustr, int col, int line, int width) { @@ -594,7 +596,7 @@ namespace Terminal.Gui { container.Move (col, line); var t = src [item]; if (t == null) { - RenderUstr (driver, ustring.Make(""), col, line, width); + RenderUstr (driver, ustring.Make (""), col, line, width); } else { if (t is ustring) { RenderUstr (driver, (ustring)t, col, line, width);