Bug 1273128 - prevent null pointer dereference on |nativeKeyEvent|. r?janv draft
authorAndi-Bogdan Postelnicu <bogdan.postelnicu@softvision.ro>
Mon, 16 May 2016 16:19:23 +0300
changeset 367366 d5994b8bcf784d1ca6a4f4d516eeb0afbf4de203
parent 367249 d0be57e84807ce0853b2406de7ff6abb195ac898
child 520989 634f5a4ce84985b2a00472c68c0c576a65c7e302
push id18218
push userBogdan.Postelnicu@softvision.ro
push dateMon, 16 May 2016 13:19:54 +0000
reviewersjanv
bugs1273128
milestone49.0a1
Bug 1273128 - prevent null pointer dereference on |nativeKeyEvent|. r?janv MozReview-Commit-ID: IOnUZfZHcnG
layout/xul/nsMenuBarListener.cpp
--- a/layout/xul/nsMenuBarListener.cpp
+++ b/layout/xul/nsMenuBarListener.cpp
@@ -206,17 +206,17 @@ 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->mAccessKeyForwardedToChild) {
+    if (nativeKeyEvent && nativeKeyEvent->mAccessKeyForwardedToChild) {
       return NS_OK;
     }
 
     nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
     uint32_t keyCode, charCode;
     keyEvent->GetKeyCode(&keyCode);
     keyEvent->GetCharCode(&charCode);