Fix possible crash in call error handling.

This commit is contained in:
John Preston 2020-08-17 10:43:51 +04:00
parent 8ce798db12
commit fe97939abf

View file

@ -409,7 +409,9 @@ void Call::redial() {
} }
QString Call::getDebugLog() const { QString Call::getDebugLog() const {
return QString::fromStdString(_instance->getDebugInfo()); return _instance
? QString::fromStdString(_instance->getDebugInfo())
: QString();
} }
void Call::startWaitingTrack() { void Call::startWaitingTrack() {
@ -833,7 +835,9 @@ void Call::handleControllerStateChange(tgcalls::State state) {
} break; } break;
case tgcalls::State::Failed: { case tgcalls::State::Failed: {
auto error = QString::fromStdString(_instance->getLastError()); auto error = _instance
? QString::fromStdString(_instance->getLastError())
: QString();
LOG(("Call Info: State changed to Failed, error: %1.").arg(error)); LOG(("Call Info: State changed to Failed, error: %1.").arg(error));
handleControllerError(error); handleControllerError(error);
} break; } break;