diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp
index c448a483d7ba..640e39ead902 100644
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -4245,16 +4245,15 @@ nsresult
nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr *outNode)
{
NS_ENSURE_TRUE(outNode && inParent, NS_ERROR_NULL_POINTER);
- nsresult res = NS_OK;
*outNode = nsnull;
- if (inOffset <= 0) {
- // return null sibling if at offset zero
+ nsCOMPtr node = nsEditor::GetChildAt(inParent,inOffset-1);
+ if (!node) {
+ // return null sibling if no sibling
return NS_OK;
}
- nsCOMPtr node = nsEditor::GetChildAt(inParent,inOffset-1);
- if (node && IsEditable(node)) {
+ if (IsEditable(node)) {
*outNode = node;
- return res;
+ return NS_OK;
}
// else
return GetPriorHTMLSibling(node, outNode);
@@ -4302,16 +4301,15 @@ nsresult
nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr *outNode)
{
NS_ENSURE_TRUE(outNode && inParent, NS_ERROR_NULL_POINTER);
- nsresult res = NS_OK;
*outNode = nsnull;
nsCOMPtr node = nsEditor::GetChildAt(inParent, inOffset + 1);
if (!node) {
// return null sibling if no sibling
return NS_OK;
}
- if (node && IsEditable(node)) {
+ if (IsEditable(node)) {
*outNode = node;
- return res;
+ return NS_OK;
}
// else
return GetNextHTMLSibling(node, outNode);