Skip to content
Snippets Groups Projects
Commit 22667e42 authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

pendingcontact: fix nullptr access

fixing non-checked defered pointer, that can be null.

Change-Id: I37b0226731852f052a0f5bffaff8a9d05a3cf7c1
parent f3bd438d
No related branches found
No related tags found
No related merge requests found
......@@ -76,16 +76,17 @@ pending_contact_requests_view_init(PendingContactRequestsView *self)
// the next signal is used to set the model in function of the selection of the account
QObject::connect(AvailableAccountModel::instance().selectionModel(), &QItemSelectionModel::currentChanged, [self](const QModelIndex& idx){
auto account = idx.data(static_cast<int>(Account::Role::Object)).value<Account*>();
GtkQTreeModel *pending_contact_requests_model;
pending_contact_requests_model = gtk_q_tree_model_new(
account->pendingContactRequestModel(),
1/*nmbr. of cols.*/,
0,
Qt::DisplayRole,
G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(pending_contact_requests_model));
if (auto account = idx.data(static_cast<int>(Account::Role::Object)).value<Account*>()) {
GtkQTreeModel *pending_contact_requests_model;
pending_contact_requests_model = gtk_q_tree_model_new(
account->pendingContactRequestModel(),
1/*nmbr. of cols.*/,
0,
Qt::DisplayRole,
G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(pending_contact_requests_model));
}
});
GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment