bug 462849 degenerated colgroups can be empty r/sr=bzbarsky
authorBernd <bmlk@gmx.de>
Mon, 03 Nov 2008 19:30:38 +0100
changeset 21228 0d685a6cfddd4be94b621a383de7354fa5f705fc
parent 21227 73350927f5f1ec7a2a77f8126d64080d3ef97a96
child 21230 a1e4bd7bf2c3ac8d5f4aeb634c20c1457c90d6ca
push idunknown
push userunknown
push dateunknown
bugs462849
milestone1.9.1b2pre
bug 462849 degenerated colgroups can be empty r/sr=bzbarsky
layout/tables/nsTableColGroupFrame.cpp
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -207,20 +207,23 @@ nsTableColGroupFrame::SetInitialChildLis
 
 /* virtual */ void
 nsTableColGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
 {
   if (!aOldStyleContext) //avoid this on init
     return;
      
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
-    
+
   if (tableFrame->IsBorderCollapse() &&
       tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
-    nsRect damageArea(GetFirstColumn()->GetColIndex(), 0, GetColCount(),
+    PRInt32 colCount = GetColCount();
+    if (!colCount)
+      return; // this is a degenerated colgroup 
+    nsRect damageArea(GetFirstColumn()->GetColIndex(), 0, colCount,
                       tableFrame->GetRowCount());
     tableFrame->SetBCDamageArea(damageArea);
   }
   return;
 }
 
 NS_IMETHODIMP
 nsTableColGroupFrame::AppendFrames(nsIAtom*        aListName,