From def772cc0efd7c22c6154c6d9f73df1a08fa2671 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 3 Nov 2021 10:52:38 +0100 Subject: Fix crash when not using text options with text options.before_syntax_highlight is not set to NULL --- src/graphics/text.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/graphics/text.c b/src/graphics/text.c index 9a849a9..723b37a 100644 --- a/src/graphics/text.c +++ b/src/graphics/text.c @@ -26,10 +26,12 @@ int mgl_text_init(mgl_text *self, mgl_font *font, const char *str, size_t str_si self->color = (mgl_color){ 255, 255, 255, 255 }; self->position = (mgl_vec2f){ 0.0f, 0.0f }; - if(options) + if(options) { self->options = *options; - else + } else { self->options.userdata = NULL; + self->options.before_syntax_highlight = NULL; + } if(!options || !options->syntax_highlight) self->options.syntax_highlight = default_syntax_highlight; -- cgit v1.2.3