diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp
index a8f45230ad0a..0b0cf405322b 100644
--- a/content/html/content/src/nsHTMLButtonElement.cpp
+++ b/content/html/content/src/nsHTMLButtonElement.cpp
@@ -434,7 +434,9 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
nsMouseEvent::eRightButton) {
// cancel all of these events for buttons
//XXXsmaug What to do with these events? Why these should be cancelled?
- aVisitor.mDOMEvent->StopPropagation();
+ if (aVisitor.mDOMEvent) {
+ aVisitor.mDOMEvent->StopPropagation();
+ }
}
}
}