diff --git a/src/impl/peerconnection.cpp b/src/impl/peerconnection.cpp index 3820ce146..7c40de78e 100644 --- a/src/impl/peerconnection.cpp +++ b/src/impl/peerconnection.cpp @@ -424,12 +424,8 @@ void PeerConnection::rollbackLocalDescription() { bool PeerConnection::checkFingerprint(const std::string &fingerprint) const { std::lock_guard lock(mRemoteDescriptionMutex); - std::string expectedFingerprint = "[none]"; - if (mRemoteDescription && mRemoteDescription->fingerprint().has_value()) { - expectedFingerprint = mRemoteDescription->fingerprint().value().value; - } - - if (expectedFingerprint == fingerprint) { + auto expectedFingerprint = mRemoteDescription && mRemoteDescription->fingerprint() ? mRemoteDescription->fingerprint().value : nullopt; + if (expectedFingerprint && *expectedFingerprint == fingerprint) { PLOG_VERBOSE << "Valid fingerprint \"" << fingerprint << "\""; return true; }