diff --git a/src/event/event-subscribe.cpp b/src/event/event-subscribe.cpp index 100f3ea7643e3eadf63d72c7919a8eca649826ee..8047e515390ed9039f0f70eb37e215f49828cdca 100644 --- a/src/event/event-subscribe.cpp +++ b/src/event/event-subscribe.cpp @@ -243,9 +243,8 @@ void EventSubscribe::terminate() { return; } + auto op = mOp ? dynamic_cast<SalSubscribeOp *>(mOp) : nullptr; if (mDir == LinphoneSubscriptionIncoming) { - auto op = dynamic_cast<SalSubscribeOp *>(mOp); - // If a dialog is already established, send a NOTIFY to close the subscription. if (op && op->isDialogEstablished()) { op->closeNotify(); @@ -260,7 +259,6 @@ void EventSubscribe::terminate() { sal_error_info_reset(&sei); } } else if (mDir == LinphoneSubscriptionOutgoing) { - auto op = dynamic_cast<SalSubscribeOp *>(mOp); if (op) { op->unsubscribe(); }