diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp
index d2454dc4f1c..6b85e82b455 100644
--- a/content/html/content/src/nsHTMLSelectElement.cpp
+++ b/content/html/content/src/nsHTMLSelectElement.cpp
@@ -478,9 +478,9 @@ nsHTMLSelectElement::SetLength(PRUint32 aLength)
}
PRUint32 curlen;
- nsresult result;
GetLength(&curlen);
if (curlen && (curlen > aLength)) { // Remove extra options
+ nsresult result=NS_OK;
for (PRInt32 i = (curlen - 1); (i>=(PRInt32)aLength) && NS_SUCCEEDED(result); i--) {
result = Remove(i);
}
diff --git a/layout/html/content/src/nsHTMLSelectElement.cpp b/layout/html/content/src/nsHTMLSelectElement.cpp
index d2454dc4f1c..6b85e82b455 100644
--- a/layout/html/content/src/nsHTMLSelectElement.cpp
+++ b/layout/html/content/src/nsHTMLSelectElement.cpp
@@ -478,9 +478,9 @@ nsHTMLSelectElement::SetLength(PRUint32 aLength)
}
PRUint32 curlen;
- nsresult result;
GetLength(&curlen);
if (curlen && (curlen > aLength)) { // Remove extra options
+ nsresult result=NS_OK;
for (PRInt32 i = (curlen - 1); (i>=(PRInt32)aLength) && NS_SUCCEEDED(result); i--) {
result = Remove(i);
}