diff options
author | David Robillard <d@drobilla.net> | 2012-08-20 23:11:39 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-08-20 23:11:39 +0000 |
commit | 08b62fe47b81117c17cbd7b08210b0a91d104126 (patch) | |
tree | 2d21c4f250a6c160686a9ea4fa47ac1132391905 /src/server/BufferFactory.cpp | |
parent | e7e8876464377e3c222e15783c39af7e411a44a3 (diff) | |
download | ingen-08b62fe47b81117c17cbd7b08210b0a91d104126.tar.gz ingen-08b62fe47b81117c17cbd7b08210b0a91d104126.tar.bz2 ingen-08b62fe47b81117c17cbd7b08210b0a91d104126.zip |
Replace several assertions with graceful error handling.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4731 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/BufferFactory.cpp')
-rw-r--r-- | src/server/BufferFactory.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index 69cba30b..da459705 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -111,7 +111,6 @@ BufferFactory::get(LV2_URID type, if (!real_time) { return create(type, capacity); } else { - assert(false); _engine.world()->log().error("Failed to obtain buffer"); return BufferRef(); } @@ -132,13 +131,12 @@ BufferFactory::create(LV2_URID type, uint32_t capacity) { if (capacity == 0) { capacity = default_size(type); + } else if (type == _uris.atom_Float) { + capacity = std::max(capacity, (uint32_t)sizeof(LV2_Atom_Float)); + } else if (type == _uris.atom_Sound) { + capacity = std::max(capacity, default_size(_uris.atom_Sound)); } - assert(type != _uris.atom_Float || - capacity >= sizeof(LV2_Atom_Float)); - assert(type != _uris.atom_Sound || - capacity >= default_size(_uris.atom_Sound)); - return BufferRef(new Buffer(*this, type, capacity)); } |