aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreen <dandelions@disroot.org>2025-04-16 02:43:52 +0200
committergreen <dandelions@disroot.org>2026-01-23 21:04:16 +0100
commitec3f28ca63f7623c1c7124a0f187ef0cb980a2d8 (patch)
treecf659390a6f7946dc561426cb3ade8dc3b03ffe1
parent2890fe25bed87f00618150affc34176fc28013cf (diff)
time-labels: fixed segfault
-rw-r--r--html.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/html.c b/html.c
index 83a163f..0f7ba92 100644
--- a/html.c
+++ b/html.c
@@ -212,10 +212,11 @@ xs_str *format_text_with_emoji(snac *user, const char *text, int ems, const char
xs_str *html_date_label(snac *user, const char *date)
{
- time_t t = xs_parse_iso_date(date, 0);
+ time_t t;
/* check if a user has actually set a timezone */
- if (t != 0 && xs_dict_get(user->config, "tz") != NULL) {
+ if (user != NULL && xs_dict_get(user->config, "tz") != NULL &&
+ (t = xs_parse_iso_date(date, 0)) != 0) {
t += xs_tz_offset(user->tz);
time_t today = time(NULL);