From c56c78f1e0e27f1e25be335ba1148a7a80ef4fd2 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 10 Sep 2013 15:40:41 +0000 Subject: [PATCH] Added a check for the number of available Cautions and Notes in the TopPart() and BottomPart() functions to avoid an index out of range error. --- PROMS/Volian.Controls.Library/StepPanel.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepPanel.cs b/PROMS/Volian.Controls.Library/StepPanel.cs index 6003357b..c5ec61db 100644 --- a/PROMS/Volian.Controls.Library/StepPanel.cs +++ b/PROMS/Volian.Controls.Library/StepPanel.cs @@ -770,8 +770,8 @@ namespace Volian.Controls.Library private ItemInfo TopPart(ItemInfo ii) { ExpandAsNeeded(ii); - if (ii.Cautions != null) return TopPart(ii.Cautions[0]); - if (ii.Notes != null) return TopPart(ii.Notes[0]); + if (ii.Cautions != null && ii.Cautions.Count > 0) return TopPart(ii.Cautions[0]); + if (ii.Notes != null && ii.Notes.Count > 0) return TopPart(ii.Notes[0]); return (ii); } /// @@ -782,10 +782,10 @@ namespace Volian.Controls.Library private ItemInfo BottomPart(ItemInfo ii) { ExpandAsNeeded(ii); - if (ii.RNOs != null && ii.RNOLevel >= ii.ColumnMode) return BottomPart(ii.RNOs[0]); - if (ii.Sections != null) return BottomPart(ii.Sections[0].LastSibling); - if (ii.Steps != null) return BottomPart(ii.Steps[0].LastSibling); - if (ii.Tables != null) return BottomPart(ii.Tables[0].LastSibling); + if (ii.RNOs != null && ii.RNOs.Count > 0 && ii.RNOLevel >= ii.ColumnMode) return BottomPart(ii.RNOs[0]); + if (ii.Sections != null && ii.Sections.Count > 0) return BottomPart(ii.Sections[0].LastSibling); + if (ii.Steps != null && ii.Steps.Count > 0) return BottomPart(ii.Steps[0].LastSibling); + if (ii.Tables != null && ii.Tables.Count > 0) return BottomPart(ii.Tables[0].LastSibling); return ii; } ///