Check that the pointer isn't NULL before dereferencing it, just to be safe and to allow using bufgetdata to know how much data is available. Also remove a few trailing spaces.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15940 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a2aec46f04
commit
ecec94043d
1 changed files with 5 additions and 3 deletions
|
@ -1135,7 +1135,9 @@ ssize_t bufgetdata(int handle_id, size_t size, void **data)
|
|||
memcpy(guard_buffer, (unsigned char *)buffer, copy_n);
|
||||
}
|
||||
|
||||
*data = &buffer[h->ridx];
|
||||
if (data)
|
||||
*data = &buffer[h->ridx];
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -1144,7 +1146,7 @@ ssize_t bufgettail(int handle_id, size_t size, void **data)
|
|||
size_t tidx;
|
||||
|
||||
const struct memory_handle *h;
|
||||
|
||||
|
||||
h = find_handle(handle_id);
|
||||
|
||||
if (!h)
|
||||
|
@ -1172,7 +1174,7 @@ ssize_t bufgettail(int handle_id, size_t size, void **data)
|
|||
ssize_t bufcuttail(int handle_id, size_t size)
|
||||
{
|
||||
struct memory_handle *h;
|
||||
|
||||
|
||||
h = find_handle(handle_id);
|
||||
|
||||
if (!h)
|
||||
|
|
Loading…
Reference in a new issue