From bbb8190ad47aca26e336c2a0461d18a12d9cf00a Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Sun, 9 Apr 2017 16:04:01 +0300 Subject: [PATCH] Removed two asserts in order to allow nk_convert() to gracefully fail when buffers do not provide enough space. --- nuklear.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nuklear.h b/nuklear.h index f1a16ac5..65c47a6e 100644 --- a/nuklear.h +++ b/nuklear.h @@ -5472,7 +5472,8 @@ nk_buffer_alloc(struct nk_buffer *b, enum nk_buffer_allocation_type type, if (full) { nk_size capacity; - NK_ASSERT(b->type == NK_BUFFER_DYNAMIC); + if (b->type != NK_BUFFER_DYNAMIC) + return 0; NK_ASSERT(b->pool.alloc && b->pool.free); if (b->type != NK_BUFFER_DYNAMIC || !b->pool.alloc || !b->pool.free) return 0; @@ -7036,7 +7037,6 @@ nk_draw_list_stroke_poly_line(struct nk_draw_list *list, const struct nk_vec2 *p nk_size size; struct nk_vec2 *normals, *temp; - NK_ASSERT(vtx && ids); if (!vtx || !ids) return; /* temporary allocate normals + points */