Check if formatted status for notification isn't constant string

FossilOrigin-Name: 3a4f7af4afdfb696214e04decb859076cc67fa697fa5a1714c76bbedd948b7b6
This commit is contained in:
nekobit 2022-05-14 21:41:15 +00:00
parent 880164bd43
commit 297a2a4f8a
2 changed files with 4 additions and 6 deletions

View file

@ -42,7 +42,7 @@ void render_base_page(struct base_page* page, struct session* ssn, mastodont_t*
// Mastodont, used for notifications sidebar
struct mstdnt_storage storage = { 0 };
struct mstdnt_notification* notifs = NULL;
size_t notifs_len;
size_t notifs_len = 0;
read_config(ssn);

View file

@ -90,7 +90,7 @@ char* construct_notification_compact(struct session* ssn,
int* size)
{
char* notif_html;
char* status_format;
char* status_format = NULL;
char* notif_stats = NULL;
const char* type_str = notification_type_compact_str(notif->type);
@ -106,9 +106,6 @@ char* construct_notification_compact(struct session* ssn,
notif->status->emojis,
notif->status->emojis_len);
}
else {
status_format = NULL;
}
size_t s = easprintf(&notif_html, data_notification_compact_html,
notif->account->avatar,
@ -127,7 +124,8 @@ char* construct_notification_compact(struct session* ssn,
if (size) *size = s;
if (status_format) free(status_format);
if (status_format &&
status_format != notif->status->content) free(status_format);
if (notif_stats) free(notif_stats);
return notif_html;
}