* Only copy over the list content if resizing/allocating the list succeded.

Fixes CID 1268.
* Remove no more correct comment.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27710 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2008-09-23 19:07:13 +00:00
parent 42dfe402c0
commit 0b559106bf

View File

@ -83,9 +83,11 @@ BList&
BList::operator =(const BList &list)
{
fBlockSize = list.fBlockSize;
_ResizeArray(list.fItemCount);
fItemCount = list.fItemCount;
memcpy(fObjectList, list.fObjectList, fItemCount * sizeof(void*));
if (_ResizeArray(list.fItemCount)) {
fItemCount = list.fItemCount;
memcpy(fObjectList, list.fObjectList, fItemCount * sizeof(void*));
}
return *this;
}
@ -451,7 +453,6 @@ void BList::_ReservedList2() {}
// Resize
//
// Resizes fObjectList to be large enough to contain count items.
// fItemCount is adjusted accordingly.
bool
BList::_ResizeArray(int32 count)
{