From 70afff326c1a113bd1f3472494b3bb204e3954cd Mon Sep 17 00:00:00 2001 From: Ryan Gregg Date: Fri, 19 Feb 2016 15:22:17 -0800 Subject: [PATCH] Fix crash for empty table headers or row --- OSS/MarkdownDeep/TableSpec.cs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/OSS/MarkdownDeep/TableSpec.cs b/OSS/MarkdownDeep/TableSpec.cs index 0083c90..f550802 100644 --- a/OSS/MarkdownDeep/TableSpec.cs +++ b/OSS/MarkdownDeep/TableSpec.cs @@ -227,15 +227,31 @@ public static TableSpec Parse(StringScanner p) #region RGregg extensions - public string[] ColumnHeaders { get { return Headers.ToArray(); } } + public string[] ColumnHeaders + { + get + { + if (null != Headers) + return Headers.ToArray(); + else + return new string[0]; + } + } public string[][] RowValues { get - { - var rowArrays = from row in Rows - select row.ToArray(); - return rowArrays.ToArray(); + { + if (null != Rows) + { + var rowArrays = from row in Rows + select row.ToArray(); + return rowArrays.ToArray(); + } + else + { + return new string[][] { new string[] { } }; + } } }