diff --git a/mozilla/editor/libeditor/text/nsTextEditRules.cpp b/mozilla/editor/libeditor/text/nsTextEditRules.cpp
index 6da76d17cb1..5c449fa6688 100644
--- a/mozilla/editor/libeditor/text/nsTextEditRules.cpp
+++ b/mozilla/editor/libeditor/text/nsTextEditRules.cpp
@@ -932,7 +932,7 @@ nsTextEditRules::WillDeleteSelection(nsISelection *aSelection,
}
// fix for bugzilla #125161: if we are about to forward delete a
,
// make sure it is not last node in editfield. If it is, cancel deletion.
- if ((aCollapsedAction == nsIEditor::eNext) && nsTextEditUtils::IsBreak(nextNode))
+ if (nextNode && (aCollapsedAction == nsIEditor::eNext) && nsTextEditUtils::IsBreak(nextNode))
{
nsCOMPtr lastChild;
if (!mBody) return NS_ERROR_NULL_POINTER;