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:
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user