summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/pipebuffer
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-05-22 21:54:41 +0900
committerJosé Fonseca <[email protected]>2008-05-22 21:54:41 +0900
commit781676c7cc5ae7586ee8edd07de880892c5a2d86 (patch)
tree1d722ea953157aae612973749e2140e175bb07a2 /src/gallium/auxiliary/pipebuffer
parentbd4eec0561fb021849ac4047fdbf40a616fb68b3 (diff)
pipebuffer: More robust face null pointers.
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.
Diffstat (limited to 'src/gallium/auxiliary/pipebuffer')
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index 49705cb8627..857ea53c786 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
@@ -146,6 +146,8 @@ pb_map(struct pb_buffer *buf,
unsigned flags)
{
assert(buf);
+ if(!buf)
+ return NULL;
return buf->vtbl->map(buf, flags);
}
@@ -154,6 +156,8 @@ static INLINE void
pb_unmap(struct pb_buffer *buf)
{
assert(buf);
+ if(!buf)
+ return;
buf->vtbl->unmap(buf);
}
@@ -163,6 +167,12 @@ pb_get_base_buffer( struct pb_buffer *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);
}
@@ -171,7 +181,8 @@ static INLINE void
pb_destroy(struct pb_buffer *buf)
{
assert(buf);
- assert(buf->vtbl);
+ if(!buf)
+ return;
buf->vtbl->destroy(buf);
}