diff --git a/editor/libeditor/HTMLEditSubActionHandler.cpp b/editor/libeditor/HTMLEditSubActionHandler.cpp
index d0b174d8cded..c73fb09612b0 100644
--- a/editor/libeditor/HTMLEditSubActionHandler.cpp
+++ b/editor/libeditor/HTMLEditSubActionHandler.cpp
@@ -9431,6 +9431,7 @@ nsresult HTMLEditor::AdjustCaretPositionAndEnsurePaddingBRElement(
if (HTMLEditUtils::IsInvisibleBRElement(*previousEditableContent) &&
!EditorUtils::IsPaddingBRElementForEmptyLastLine(
*previousEditableContent)) {
+ AutoEditorDOMPointChildInvalidator lockOffset(point);
Result insertPaddingBRElementResult =
InsertPaddingBRElementForEmptyLastLineWithTransaction(point);
if (MOZ_UNLIKELY(insertPaddingBRElementResult.isErr())) {