diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index 2a0ea9c936ef..2daabcdc99b5 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -722,7 +722,7 @@ nsLocalFile::CopyDirectoryTo(nsIFile* aNewParent) } bool hasMore = false; - while (dirIterator->HasMoreElements(&hasMore), hasMore) { + while (NS_SUCCEEDED(dirIterator->HasMoreElements(&hasMore)) && hasMore) { nsCOMPtr supports; nsCOMPtr entry; rv = dirIterator->GetNext(getter_AddRefs(supports)); @@ -1050,7 +1050,7 @@ nsLocalFile::Remove(bool aRecursive) } bool more; - while (dir->HasMoreElements(&more), more) { + while (NS_SUCCEEDED(dir->HasMoreElements(&more)) && more) { nsCOMPtr item; rv = dir->GetNext(getter_AddRefs(item)); if (NS_FAILED(rv)) {