Bug 1555640 - Check if `aPointAfterInsertedString` is nullptr when `WSRunObject::InsertText()` sets its value r=m_kato a=jcristau
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 30 May 2019 10:32:44 +0000
changeset 536603 72e634f9360acbc01148c18bad4fbbb4defb3238
parent 536602 44ec76478317fdc6fba90c55771f6514c32e388b
child 536604 96f529152295d6551c17f7d7f70eeaa578e375b2
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato, jcristau
bugs1555640, 1534394
Bug 1555640 - Check if `aPointAfterInsertedString` is nullptr when `WSRunObject::InsertText()` sets its value r=m_kato a=jcristau `aPointAfterInsertedString` of `WSRunObject::InsertText()` is optional (i.e., may be nullptr). However, the fix for bug 1534394 makes it always set to original insertion point when `InsertTextWithTransaction()` is failed. This patch just make it check if `aPointAfterInsertedString` is nullptr before setting its value. Differential Revision: https://phabricator.services.mozilla.com/D33144
--- a/editor/libeditor/WSRunObject.cpp
+++ b/editor/libeditor/WSRunObject.cpp
@@ -374,17 +374,19 @@ nsresult WSRunObject::InsertText(Documen
   //     modify it and make each caller of this method decide whether it should
   //     keep or stop handling the edit action.
   nsresult rv =
           ->InsertTextWithTransaction(aDocument, theString, pointToInsert,
   if (NS_WARN_IF(NS_FAILED(rv))) {
     // XXX Temporarily, set new insertion point to the original point.
-    *aPointAfterInsertedString = pointToInsert;
+    if (aPointAfterInsertedString) {
+      *aPointAfterInsertedString = pointToInsert;
+    }
     return NS_OK;
   return NS_OK;
 nsresult WSRunObject::DeleteWSBackward() {
   WSPoint point = GetPreviousCharPoint(mScanStartPoint);
   NS_ENSURE_TRUE(point.mTextNode, NS_OK);  // nothing to delete