BPackageInfoSet::Iterator: Fix NULL pointer dereference

Since the BPackageInfoSet's map is created lazily, it can be NULL when
an Iterator is constructed.
This commit is contained in:
Ingo Weinhold
2013-04-14 17:06:25 +02:00
parent 8a4ebe2c46
commit b2d96da589
2 changed files with 2 additions and 11 deletions
+1 -2
View File
@@ -49,8 +49,7 @@ private:
class BPackageInfoSet::Iterator {
public:
Iterator();
Iterator(const PackageMap* map);
Iterator(const PackageMap* map = NULL);
bool HasNext() const;
const BPackageInfo* Next();
+1 -9
View File
@@ -173,18 +173,10 @@ private:
// #pragma mark - Iterator
BPackageInfoSet::Iterator::Iterator()
:
fMap(NULL),
fNextInfo(NULL)
{
}
BPackageInfoSet::Iterator::Iterator(const PackageMap* map)
:
fMap(map),
fNextInfo(map->GetIterator().Next())
fNextInfo(map != NULL ? map->GetIterator().Next() : NULL)
{
}