diff options
Diffstat (limited to 'dom/events/InvokeEvent.cpp')
-rw-r--r-- | dom/events/InvokeEvent.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/dom/events/InvokeEvent.cpp b/dom/events/InvokeEvent.cpp index 4b7dc1e6da..3312f8138d 100644 --- a/dom/events/InvokeEvent.cpp +++ b/dom/events/InvokeEvent.cpp @@ -47,9 +47,13 @@ already_AddRefed<InvokeEvent> InvokeEvent::Constructor( Element* InvokeEvent::GetInvoker() { EventTarget* currentTarget = GetCurrentTarget(); if (currentTarget) { + nsINode* currentTargetNode = currentTarget->GetAsNode(); + if (!currentTargetNode) { + return nullptr; + } nsINode* retargeted = nsContentUtils::Retarget( - static_cast<nsINode*>(mInvoker), currentTarget->GetAsNode()); - return retargeted->AsElement(); + static_cast<nsINode*>(mInvoker), currentTargetNode); + return retargeted ? retargeted->AsElement() : nullptr; } MOZ_ASSERT(!mEvent->mFlags.mIsBeingDispatched); return mInvoker; |