diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index d212020b381..82a71944165 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -2472,15 +2472,15 @@ nsFrame::GetSelectionController(nsIPresContext *aPresContext, nsISelectionContro if (state & NS_FRAME_INDEPENDENT_SELECTION) { nsIFrame *tmp = this; - nsresult result = tmp->GetParent(&tmp);//start one up from this one on the parent chain - while (NS_SUCCEEDED(result) && tmp) + while (tmp) { nsIGfxTextControlFrame2 *tcf; if (NS_SUCCEEDED(tmp->QueryInterface(NS_GET_IID(nsIGfxTextControlFrame2),(void**)&tcf))) { return tcf->GetSelectionContr(aSelCon); } - result = NS_FAILED(tmp->GetParent(&tmp)); + if (NS_FAILED(tmp->GetParent(&tmp))) + break; } } nsCOMPtr shell; diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index d212020b381..82a71944165 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -2472,15 +2472,15 @@ nsFrame::GetSelectionController(nsIPresContext *aPresContext, nsISelectionContro if (state & NS_FRAME_INDEPENDENT_SELECTION) { nsIFrame *tmp = this; - nsresult result = tmp->GetParent(&tmp);//start one up from this one on the parent chain - while (NS_SUCCEEDED(result) && tmp) + while (tmp) { nsIGfxTextControlFrame2 *tcf; if (NS_SUCCEEDED(tmp->QueryInterface(NS_GET_IID(nsIGfxTextControlFrame2),(void**)&tcf))) { return tcf->GetSelectionContr(aSelCon); } - result = NS_FAILED(tmp->GetParent(&tmp)); + if (NS_FAILED(tmp->GetParent(&tmp))) + break; } } nsCOMPtr shell;