HaikuDepot: Fixed some inconsistencies in List.h
This commit is contained in:
parent
55ef89adc2
commit
96c5f7eda4
@ -120,10 +120,8 @@ public:
|
||||
|
||||
inline bool Add(const ItemType& copyFrom, int32 index)
|
||||
{
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
if (index > (int32)fCount)
|
||||
index = fCount;
|
||||
if (index < 0 || index >= (int32)fCount)
|
||||
return false;
|
||||
|
||||
if (!_Resize(fCount + 1))
|
||||
return false;
|
||||
@ -190,7 +188,7 @@ public:
|
||||
|
||||
inline const ItemType& ItemAt(int32 index) const
|
||||
{
|
||||
if (index >= (int32)fCount)
|
||||
if (index < 0 || index >= (int32)fCount)
|
||||
return fNullItem;
|
||||
return ItemAtFast(index);
|
||||
}
|
||||
@ -202,6 +200,8 @@ public:
|
||||
|
||||
inline const ItemType& LastItem() const
|
||||
{
|
||||
if (fCount == 0)
|
||||
return fNullItem;
|
||||
return ItemAt((int32)fCount - 1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user