Bug 382471. Don't crash when wigets aren't present. patch by Eli Friedman, r+sr=roc

This commit is contained in:
roc+@cs.cmu.edu 2007-05-31 16:23:05 -07:00
parent 2ef14cf331
commit e987b74e4a

View File

@ -356,7 +356,8 @@ nsRect nsView::CalcWidgetBounds(nsWindowType aType)
nsIWidget* parentWidget = GetParent()->GetNearestWidget(&offset);
viewBounds += offset;
if (aType == eWindowType_popup && mVis == nsViewVisibility_kShow) {
if (parentWidget && Type == eWindowType_popup &&
mVis == nsViewVisibility_kShow) {
nsRect screenRect(0,0,1,1);
parentWidget->WidgetToScreen(screenRect, screenRect);
viewBounds += nsPoint(NSIntPixelsToAppUnits(screenRect.x, p2a),