changeset 153:dd892567f054

Fixes #174: HTML output can add empty tables for stat lines * Check if table has rows before outputting it
author IBBoard <dev@ibboard.co.uk>
date Sat, 26 Sep 2009 19:57:06 +0000
parents 0c0e14f03785
children 4a02c07278e7
files api/Exporters/WarFoundryHtmlExporter.cs
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/api/Exporters/WarFoundryHtmlExporter.cs	Sat Sep 26 19:51:11 2009 +0000
+++ b/api/Exporters/WarFoundryHtmlExporter.cs	Sat Sep 26 19:57:06 2009 +0000
@@ -56,8 +56,11 @@
 			body.AppendChild(header);
 			
 			foreach (XmlElement table in CreateTables(army, doc))
-			{
-				body.AppendChild(table);
+			{
+				if (!IsTableOnlyHeader(table))
+				{
+					body.AppendChild(table);
+				}
 			}
 			
 			StreamWriter writer = new StreamWriter(path, false);
@@ -70,6 +73,11 @@
 			{
 				writer.Close();
 			}
+		}
+
+		private bool IsTableOnlyHeader(XmlElement table)
+		{
+			return table.ChildNodes.Count == 1;
 		}
 		
 		private XmlElement[] CreateTables(Army army, XmlDocument doc)