commit 3e95d96
Merge pull request 'segfault fix' (#521) from byte/snac2:fix_segfault into master Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/521
1 files changed,
+4,
-1
M
html.c
M
html.c
+4,
-1
1@@ -167,6 +167,7 @@ xs_str *actor_pronouns(xs_dict *actor)
2 {
3 const xs_list *attachment;
4 const xs_dict *d;
5+ const char *v;
6 const char *pronouns = "";
7 xs_str *ret;
8
9@@ -175,7 +176,9 @@ xs_str *actor_pronouns(xs_dict *actor)
10 xs *prop = xs_utf8_to_lower(xs_dict_get(d, "name"));
11 /* make sure that we are reading the correct metadata */
12 if (strlen(prop) == 8 && strcmp(prop, "pronouns") == 0) {
13- pronouns = xs_dict_get(d, "value");
14+ /* safeguard from NULL values */
15+ v = xs_dict_get(d, "value");
16+ pronouns = v ? v : pronouns;
17 break;
18 }
19 }