From 3885949c5b573ab3c20af680609b7c9ca5060a98 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 12 Oct 2024 15:26:47 -0400 Subject: [PATCH] resolve a static analyzer complaint in glyphs.c src/glyphs.c(680): warning: Dereferencing NULL pointer. 'other' contains the same NULL value as 'obj_glyphs[idx].u' did. --- src/glyphs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/glyphs.c b/src/glyphs.c index c13df781a..d95764060 100644 --- a/src/glyphs.c +++ b/src/glyphs.c @@ -675,12 +675,14 @@ shuffle_customizations(void) tmp_customcolor[i] = other_customcolor; tmp_color256idx[i] = other_color256idx; #ifdef ENHANCED_SYMBOLS - tmp_u[i] = (struct unicode_representation *) - alloc(sizeof *tmp_u[i]); - *tmp_u[i] = *other; - if (other->utf8str != NULL) { - tmp_u[i]->utf8str = (uint8 *) - dupstr((const char *) other->utf8str); + if (other) { + tmp_u[i] = (struct unicode_representation *) alloc( + sizeof *tmp_u[i]); + *tmp_u[i] = *other; + if (other->utf8str != NULL) { + tmp_u[i]->utf8str = + (uint8 *) dupstr((const char *) other->utf8str); + } } #endif } else {