Index: Source/core/html/HTMLCollection.cpp |
diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp |
index 83a79e47374c7e1366ccccaf69d4636b31a4095a..451a8870265b48945c6505857bb5f823b496c0b5 100644 |
--- a/Source/core/html/HTMLCollection.cpp |
+++ b/Source/core/html/HTMLCollection.cpp |
@@ -507,14 +507,14 @@ void HTMLCollection::namedItems(const AtomicString& name, WillBeHeapVector<RefPt |
updateIdNameCache(); |
const NamedItemCache& cache = namedItemCache(); |
- WillBeHeapVector<RawPtrWillBeMember<Element> >* idResults = cache.getElementsById(name); |
- WillBeHeapVector<RawPtrWillBeMember<Element> >* nameResults = cache.getElementsByName(name); |
- |
- for (unsigned i = 0; idResults && i < idResults->size(); ++i) |
- result.append(idResults->at(i)); |
- |
- for (unsigned i = 0; nameResults && i < nameResults->size(); ++i) |
- result.append(nameResults->at(i)); |
+ if (WillBeHeapVector<RawPtrWillBeMember<Element> >* idResults = cache.getElementsById(name)) { |
+ for (unsigned i = 0; i < idResults->size(); ++i) |
+ result.append(idResults->at(i)); |
+ } |
+ if (WillBeHeapVector<RawPtrWillBeMember<Element> >* nameResults = cache.getElementsByName(name)) { |
+ for (unsigned i = 0; i < nameResults->size(); ++i) |
+ result.append(nameResults->at(i)); |
+ } |
} |
HTMLCollection::NamedItemCache::NamedItemCache() |