It is really the caller responsibility not to call pipebuffer with null
buffers, etc. But don't let the crash happen here, and still asserting
early.
unsigned flags)
{
assert(buf);
+ if(!buf)
+ return NULL;
return buf->vtbl->map(buf, flags);
}
pb_unmap(struct pb_buffer *buf)
{
assert(buf);
+ if(!buf)
+ return;
buf->vtbl->unmap(buf);
}
struct pb_buffer **base_buf,
unsigned *offset )
{
+ assert(buf);
+ if(!buf) {
+ base_buf = NULL;
+ offset = 0;
+ return;
+ }
buf->vtbl->get_base_buffer(buf, base_buf, offset);
}
pb_destroy(struct pb_buffer *buf)
{
assert(buf);
- assert(buf->vtbl);
+ if(!buf)
+ return;
buf->vtbl->destroy(buf);
}