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 {
|
class BPackageInfoSet::Iterator {
|
||||||
public:
|
public:
|
||||||
Iterator();
|
Iterator(const PackageMap* map = NULL);
|
||||||
Iterator(const PackageMap* map);
|
|
||||||
|
|
||||||
bool HasNext() const;
|
bool HasNext() const;
|
||||||
const BPackageInfo* Next();
|
const BPackageInfo* Next();
|
||||||
|
|||||||
@@ -173,18 +173,10 @@ private:
|
|||||||
// #pragma mark - Iterator
|
// #pragma mark - Iterator
|
||||||
|
|
||||||
|
|
||||||
BPackageInfoSet::Iterator::Iterator()
|
|
||||||
:
|
|
||||||
fMap(NULL),
|
|
||||||
fNextInfo(NULL)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BPackageInfoSet::Iterator::Iterator(const PackageMap* map)
|
BPackageInfoSet::Iterator::Iterator(const PackageMap* map)
|
||||||
:
|
:
|
||||||
fMap(map),
|
fMap(map),
|
||||||
fNextInfo(map->GetIterator().Next())
|
fNextInfo(map != NULL ? map->GetIterator().Next() : NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user