Commit 6a478f28 authored by Guillaume Roguez's avatar Guillaume Roguez

mainwindow: fix nullptr access when search entry text changed

This patch prevents nullptr access when you search entry text (contact)
is changed, that causes a crash.

Refs #73567

Change-Id: Ib154073435a15f7c74d45c9ad842b7fcb2dc1da1
parent 7be4f62a
......@@ -704,13 +704,15 @@ search_entry_text_changed(GtkEditable *search_entry, RingMainWindow *win)
if (text && strlen(text) > 0) {
/* edit the the dialing call (or create a new one) */
Call *call = CallModel::instance()->dialingCall();
call->setDialNumber(text);
priv->q_completion_model->setCall(call);
if (auto call = CallModel::instance()->dialingCall()) {
call->setDialNumber(text);
priv->q_completion_model->setCall(call);
}
} else {
Call *call = priv->q_completion_model->call();
if (call->lifeCycleState() == Call::LifeCycleState::CREATION)
call->performAction(Call::Action::REFUSE);
if (auto call = priv->q_completion_model->call()) {
if (call->lifeCycleState() == Call::LifeCycleState::CREATION)
call->performAction(Call::Action::REFUSE);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment