diff --git a/layout/html/document/src/nsHTMLFrameset.cpp b/layout/html/document/src/nsHTMLFrameset.cpp
index 5e65d34c653..e4e18ad138c 100644
--- a/layout/html/document/src/nsHTMLFrameset.cpp
+++ b/layout/html/document/src/nsHTMLFrameset.cpp
@@ -704,10 +704,14 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext,
if (firstTime) {
// set the visibility of borders
for (int verX = 0; verX < mNumCols-1; verX++) {
- verBorders[verX]->SetVisibility(verBordersVis[verX]);
+ if (verBorders[verX]) {
+ verBorders[verX]->SetVisibility(verBordersVis[verX]);
+ }
}
for (int horX = 0; horX < mNumRows-1; horX++) {
- horBorders[horX]->SetVisibility(horBordersVis[horX]);
+ if (horBorders[horX]) {
+ horBorders[horX]->SetVisibility(horBordersVis[horX]);
+ }
}
delete[] verBordersVis;