diff --git a/content/events/src/nsContentEventHandler.cpp b/content/events/src/nsContentEventHandler.cpp index c3fb6a80c7b4..f479ecf392f3 100644 --- a/content/events/src/nsContentEventHandler.cpp +++ b/content/events/src/nsContentEventHandler.cpp @@ -106,6 +106,9 @@ nsContentEventHandler::Init(nsQueryContentEvent* aEvent) nsRect r; nsIFrame* frame = caret->GetGeometry(mSelection, &r); + if (!frame) { + frame = mRootContent->GetPrimaryFrame(); + } NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); aEvent->mReply.mFocusedWidget = frame->GetNearestWidget();