Bug 1204291 - Null check the argument of AutoHideSelectionChanges::AutoHideSelectionChanges()
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 12 Sep 2015 22:58:46 -0400
changeset 262217 01fa417ff4e9da1a03b3360288d7eb0dcc51c710
parent 262216 0a017caf03c4978b453e853f440a62755e9761ef
child 262218 586eaa0104b4e85cd76481068a85a31bc5ce1b01
push id64945
push usereakhgari@mozilla.com
push dateSun, 13 Sep 2015 02:59:03 +0000
treeherdermozilla-inbound@01fa417ff4e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1204291
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1204291 - Null check the argument of AutoHideSelectionChanges::AutoHideSelectionChanges()
layout/generic/nsSelection.cpp
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -6257,17 +6257,19 @@ Selection::SetSelectionDirection(nsDirec
 JSObject*
 Selection::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return mozilla::dom::SelectionBinding::Wrap(aCx, this, aGivenProto);
 }
 
 // AutoHideSelectionChanges
 AutoHideSelectionChanges::AutoHideSelectionChanges(const nsFrameSelection* aFrame)
-  : AutoHideSelectionChanges(aFrame->GetSelection(nsISelectionController::SELECTION_NORMAL))
+  : AutoHideSelectionChanges(aFrame ?
+                             aFrame->GetSelection(nsISelectionController::SELECTION_NORMAL) :
+                             nullptr)
 {}
 
 // nsAutoCopyListener
 
 nsAutoCopyListener* nsAutoCopyListener::sInstance = nullptr;
 
 NS_IMPL_ISUPPORTS(nsAutoCopyListener, nsISelectionListener)