From a3d946e313c130f49cac503e5164d60e90fcda73 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Thu, 30 May 2019 10:32:44 +0000 Subject: [PATCH] Bug 1555640 - Check if `aPointAfterInsertedString` is nullptr when `WSRunObject::InsertText()` sets its value r=m_kato `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 --HG-- extra : moz-landing-system : lando --- editor/libeditor/WSRunObject.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/libeditor/WSRunObject.cpp b/editor/libeditor/WSRunObject.cpp index ac2314b63672..8c1416c87113 100644 --- a/editor/libeditor/WSRunObject.cpp +++ b/editor/libeditor/WSRunObject.cpp @@ -380,7 +380,9 @@ nsresult WSRunObject::InsertText(Document& aDocument, aPointAfterInsertedString); 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;