Index: Source/core/html/HTMLLabelElement.cpp |
diff --git a/Source/core/html/HTMLLabelElement.cpp b/Source/core/html/HTMLLabelElement.cpp |
index f6dc7fc6d24226728ca4fbad415e0a585b3523df..1d4c0393c169efa8b9cc9ce507f9c712ded79a70 100644 |
--- a/Source/core/html/HTMLLabelElement.cpp |
+++ b/Source/core/html/HTMLLabelElement.cpp |
@@ -142,8 +142,13 @@ void HTMLLabelElement::defaultEventHandler(Event* evt) |
// selected, do not pass the event to control element. |
// Note: a click event may be not a mouse event if created by |
// document.createEvent(). |
- if (evt->isMouseEvent() && !toMouseEvent(evt)->isSimulated() && document().frame()->selection().selection().isRange()) |
- return; |
+ if (evt->isMouseEvent() && !toMouseEvent(evt)->isSimulated()) { |
+ if (LocalFrame* frame = document().frame()) { |
+ if (frame->selection().selection().isRange()) |
+ return; |
+ } |
+ } |
+ |
RefPtrWillBeRawPtr<HTMLElement> element = control(); |