temporary_buffer: fix wrong oom check
If malloc(0) is allowed to return nullptr, so don't throw an exception in that case.
This commit is contained in:
@@ -20,7 +20,7 @@ public:
|
||||
explicit temporary_buffer(size_t size)
|
||||
: _buffer(static_cast<CharType*>(malloc(size * sizeof(CharType)))), _size(size)
|
||||
, _deleter(make_free_deleter(_buffer)) {
|
||||
if (!_buffer) {
|
||||
if (size && !_buffer) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user