diff --git a/mozilla/editor/libeditor/html/nsHTMLAnonymousUtils.cpp b/mozilla/editor/libeditor/html/nsHTMLAnonymousUtils.cpp
index 7c19b89030c..526aa6c67e4 100644
--- a/mozilla/editor/libeditor/html/nsHTMLAnonymousUtils.cpp
+++ b/mozilla/editor/libeditor/html/nsHTMLAnonymousUtils.cpp
@@ -203,6 +203,7 @@ nsHTMLEditor::CheckSelectionStateForAnonymousButtons(nsISelection * aSelection)
nsCOMPtr focusElement;
// let's get the containing element of the selection
nsresult res = GetSelectionContainer(getter_AddRefs(focusElement));
+ if (!focusElement) return NS_OK;
if (NS_FAILED(res)) return res;
// what's its tag?