* Fixed a possible NULL pointer access in case the list is empty.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35615 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
51e29291d2
commit
791b130291
@ -974,11 +974,8 @@ static inline data_node*
|
|||||||
get_node_at_offset(net_buffer_private* buffer, size_t offset)
|
get_node_at_offset(net_buffer_private* buffer, size_t offset)
|
||||||
{
|
{
|
||||||
data_node* node = (data_node*)list_get_first_item(&buffer->buffers);
|
data_node* node = (data_node*)list_get_first_item(&buffer->buffers);
|
||||||
while (node->offset + node->used <= offset) {
|
while (node != NULL && node->offset + node->used <= offset)
|
||||||
node = (data_node*)list_get_next_item(&buffer->buffers, node);
|
node = (data_node*)list_get_next_item(&buffer->buffers, node);
|
||||||
if (node == NULL)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user