Bug 1276901 - prevent null pointer dereference on |nativeKeyEvent|. r?dholbert
MozReview-Commit-ID: J3GtMQDU1Yq
--- a/layout/xul/nsMenuBarListener.cpp
+++ b/layout/xul/nsMenuBarListener.cpp
@@ -206,17 +206,18 @@ nsMenuBarListener::KeyPress(nsIDOMEvent*
InitAccessKey();
if (mAccessKey)
{
// If accesskey handling was forwarded to a child process, wait for
// the mozaccesskeynotfound event before handling accesskeys.
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
- if (nativeKeyEvent && nativeKeyEvent->mAccessKeyForwardedToChild) {
+ if (!nativeKeyEvent ||
+ (nativeKeyEvent && nativeKeyEvent->mAccessKeyForwardedToChild)) {
return NS_OK;
}
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
uint32_t keyCode, charCode;
keyEvent->GetKeyCode(&keyCode);
keyEvent->GetCharCode(&charCode);