From 33930ccdcc636074dc40452b575ebfeb363c97ac Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 26 Jun 2011 16:00:33 +0100 Subject: [PATCH] html: don't crash on empty notes list --- SparkleShare/SparkleController.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index b0639a38..db996dab 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -400,16 +400,18 @@ namespace SparkleShare { if (change_set.SupportsNotes) { comments = ""; - change_set.Notes.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); - - foreach (SparkleNote note in change_set.Notes) { - comments += "" + - " " + - " " + - "" + - "" + - " " + - ""; + if (change_set.Notes != null) { + change_set.Notes.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); + + foreach (SparkleNote note in change_set.Notes) { + comments += "" + + " " + + " " + + "" + + "" + + " " + + ""; + } } comments += "
" + note.UserName + "" + note.Timestamp.ToString ("d MMM") + "
" + note.Body + "
" + note.UserName + "" + note.Timestamp.ToString ("d MMM") + "
" + note.Body + "
";