summaryrefslogtreecommitdiffstats
path: root/firmware/buflib.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/buflib.c')
-rw-r--r--firmware/buflib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c
index 0f8836b3b7..cb35290c03 100644
--- a/firmware/buflib.c
+++ b/firmware/buflib.c
@@ -894,7 +894,7 @@ bool
buflib_shrink(struct buflib_context* ctx, int handle, void* new_start, size_t new_size)
{
char* oldstart = buflib_get_data(ctx, handle);
- char* newstart = new_start;
+ char* newstart = new_start != NULL ? new_start : oldstart;
char* newend = newstart + new_size;
/* newstart must be higher and new_size not "negative" */