Skip to content

Commit

Permalink
Fix crash on reconnection in the chat window
Browse files Browse the repository at this point in the history
Profanity tries to access the nickname from the roster,
but roster is being cleaned already,
thus leading to use-after-free.

Fix #1894 #1894
  • Loading branch information
H3rnand3zzz committed Oct 15, 2023
1 parent be42ffc commit 3838e5a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ui/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ win_get_title(ProfWin* window)
{
const ProfChatWin* chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
const PContact contact = roster_get_contact(chatwin->barejid);
PContact contact = NULL;
if (roster_exists()) {
contact = roster_get_contact(chatwin->barejid);
}
if (!contact) {
return g_strdup(chatwin->barejid);
}
Expand Down

0 comments on commit 3838e5a

Please sign in to comment.