add null check
parent
24cc37f220
commit
1dc08ca723
|
@ -1,7 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
include(cmake/color.cmake)
|
include(cmake/color.cmake)
|
||||||
|
|
||||||
set(BLT_VERSION 0.14.8)
|
set(BLT_VERSION 0.14.9)
|
||||||
set(BLT_TEST_VERSION 0.0.1)
|
set(BLT_TEST_VERSION 0.0.1)
|
||||||
|
|
||||||
set(BLT_TARGET BLT)
|
set(BLT_TARGET BLT)
|
||||||
|
|
|
@ -728,6 +728,8 @@ namespace blt
|
||||||
*/
|
*/
|
||||||
void* allocate_bytes(blt::size_t bytes, blt::size_t alignment)
|
void* allocate_bytes(blt::size_t bytes, blt::size_t alignment)
|
||||||
{
|
{
|
||||||
|
if (head == nullptr)
|
||||||
|
return nullptr;
|
||||||
blt::size_t remaining_bytes = BLOCK_REMAINDER - static_cast<blt::size_t>(head->metadata.offset - head->buffer);
|
blt::size_t remaining_bytes = BLOCK_REMAINDER - static_cast<blt::size_t>(head->metadata.offset - head->buffer);
|
||||||
auto pointer = static_cast<void*>(head->metadata.offset);
|
auto pointer = static_cast<void*>(head->metadata.offset);
|
||||||
return std::align(alignment, bytes, pointer, remaining_bytes);
|
return std::align(alignment, bytes, pointer, remaining_bytes);
|
||||||
|
|
Loading…
Reference in New Issue