X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fbuffer.cpp;fp=source%2Fcore%2Fbuffer.cpp;h=36ac440a54426c186c16ae238c51a337312445e8;hb=be962824e72a7d5e2946ad4c0e69e01c60da30e8;hp=d5fc29d11635830042b1b065905c818c1d3ac79d;hpb=b294ef47df0ae87c42fe8114987817fb28326f10;p=libs%2Fgl.git diff --git a/source/core/buffer.cpp b/source/core/buffer.cpp index d5fc29d1..36ac440a 100644 --- a/source/core/buffer.cpp +++ b/source/core/buffer.cpp @@ -58,7 +58,7 @@ void Buffer::require_size(size_t req_sz) const void *Buffer::map() { - if(!can_map() || mapped) + if(size==0 || !can_map() || mapped) throw invalid_operation("Buffer::map"); void *result = BufferBackend::map(); mapped = true; @@ -67,8 +67,8 @@ void *Buffer::map() bool Buffer::unmap() { - if(!can_map() || !mapped) - throw invalid_operation("Buffer::map"); + if(size==0 || !can_map() || !mapped) + throw invalid_operation("Buffer::unmap"); bool result = BufferBackend::unmap(); mapped = false; return result;