* "next" & "previous" could be NULL, but were still referenced - based on

Oliver's patch for bug #4896 which this one fixes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33908 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-11-05 19:29:24 +00:00
parent 59ea286fac
commit 6e48ebf446

View File

@ -338,11 +338,19 @@ FragmentPacket::AddFragment(uint16 start, uint16 end, net_buffer* buffer,
status_t status = gBufferModule->merge(buffer, next, true);
TRACE(" merge next: %s", strerror(status));
if (status != B_OK) {
fFragments.Insert((net_buffer*)previous->link.next, next);
// Insert "next" at its previous position
if (previous != NULL)
fFragments.Insert((net_buffer*)previous->link.next, next);
else
fFragments.Insert(next);
return status;
}
fFragments.Insert((net_buffer*)previous->link.next, buffer);
if (previous != NULL)
fFragments.Insert((net_buffer*)previous->link.next, buffer);
else
fFragments.Insert(buffer);
// cut down existing hole
fBytesLeft -= end - start;