From 2c9d0c78e43599b286861885952e502eeb76a268 Mon Sep 17 00:00:00 2001 From: IoI_xD Date: Fri, 17 Jul 2026 22:15:33 -0700 Subject: [PATCH] allow null for name --- src/core.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core.c b/src/core.c index c77d450..b984bb7 100644 --- a/src/core.c +++ b/src/core.c @@ -225,14 +225,19 @@ static void lldarkthemehandler(MwLL handle, void* data) { static MwWidget MwCreateWidget_Internal(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, int do_prop, va_list prop) { MwWidget h = malloc(sizeof(*h)); - h->name = MwStringDuplicate(name); + if(name) + h->name = MwStringDuplicate(name); + else + h->name = NULL; h->parent = parent; h->children = NULL; if(widget_class != NULL) { if((h->lowlevel = MwLLCreate(parent == NULL ? NULL : parent->lowlevel, x, y, width, height)) == NULL) { - free(h->name); + if(h->name) { + free(h->name); + } free(h); return NULL; } @@ -411,7 +416,7 @@ void MwFreeWidget(MwWidget handle) { } } - free(handle->name); + if(handle->name) free(handle->name); if(handle->lowlevel != NULL) MwLLDestroy(handle->lowlevel);