1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Fix crash on reconnection in the chat window

Profanity tries to access the nickname from the roster,
but roster is being cleaned already,
thus leading to use-after-free.

Fix #1894 https://github.com/profanity-im/profanity/issues/1894
This commit is contained in:
John Hernandez 2023-10-15 23:24:13 +02:00
parent be42ffcee9
commit 3838e5a982

View File

@ -312,7 +312,10 @@ win_get_title(ProfWin* window)
{ {
const ProfChatWin* chatwin = (ProfChatWin*)window; const ProfChatWin* chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); 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) { if (!contact) {
return g_strdup(chatwin->barejid); return g_strdup(chatwin->barejid);
} }