diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 66919b95..e598c50b 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -620,12 +620,12 @@ mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation) } void -mucwin_role_list_error(const char *const roomjid, const char *const role, const char *const error) +mucwin_role_list_error(ProfMucWin *mucwin, const char *const role, const char *const error) { - ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - if (window) { - win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", role, error); - } + assert(mucwin != NULL); + + ProfWin *window = (ProfWin*)mucwin; + win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", role, error); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index 6dd32000..57741bbc 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -203,7 +203,7 @@ void mucwin_affiliation_set_error(const char *const roomjid, const char *const j const char *const affiliation, const char *const error); void mucwin_role_set_error(const char *const roomjid, const char *const nick, const char *const role, const char *const error); -void mucwin_role_list_error(const char *const roomjid, const char *const role, const char *const error); +void mucwin_role_list_error(ProfMucWin *mucwin, const char *const role, const char *const error); void mucwin_handle_role_list(const char *const roomjid, const char *const role, GSList *nicks); void mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const error); diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 025690b2..e62e49bf 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -1397,7 +1397,10 @@ _room_role_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const sta if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); log_debug("Error retrieving %s list for room %s: %s", role, from, error_message); - mucwin_role_list_error(from, role, error_message); + ProfMucWin *mucwin = wins_get_muc(from); + if (mucwin) { + mucwin_role_list_error(mucwin, role, error_message); + } free(error_message); free(role); return 0; diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 505f30f5..cc521778 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -277,7 +277,7 @@ void mucwin_affiliation_set_error(const char * const roomjid, const char * const const char * const affiliation, const char * const error) {} void mucwin_role_set_error(const char * const roomjid, const char * const nick, const char * const role, const char * const error) {} -void mucwin_role_list_error(const char * const roomjid, const char * const role, const char * const error) {} +void mucwin_role_list_error(ProfMucWin *mucwin, const char * const role, const char * const error) {} void mucwin_handle_role_list(const char * const roomjid, const char * const role, GSList *nicks) {} void mucwin_kick_error(ProfMucWin *mucwin, const char * const nick, const char * const error) {} void ui_show_form(ProfMucConfWin *confwin) {}