From c212c3388657742aa15f3996db911dac0cf53961 Mon Sep 17 00:00:00 2001 From: JupiterRider <60042618+JupiterRider@users.noreply.github.com> Date: Thu, 16 May 2024 19:05:18 +0200 Subject: [PATCH] [raygui] empty string will cause the draw of a title-bar, but nil doesn't --- raygui/raygui.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/raygui/raygui.go b/raygui/raygui.go index 2e7a6ed..379875a 100644 --- a/raygui/raygui.go +++ b/raygui/raygui.go @@ -356,8 +356,11 @@ func ScrollPanel(bounds rl.Rectangle, text string, content rl.Rectangle, scroll cbounds.y = C.float(bounds.Y) cbounds.width = C.float(bounds.Width) cbounds.height = C.float(bounds.Height) - ctext := C.CString(text) - defer C.free(unsafe.Pointer(ctext)) + var ctext *C.char + if len(text) > 0 { + ctext = C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + } var ccontent C.struct_Rectangle ccontent.x = C.float(content.X) ccontent.y = C.float(content.Y)