From 784a0499549308e3ef3f7d8cebabba479f8ea9e9 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Wed, 12 Oct 2022 17:08:24 +0200 Subject: [PATCH] wifi: GetAffiliatedStaAddress() returns nullopt if the remote station is not an MLD ...instead of asserting. --- src/wifi/model/wifi-remote-station-manager.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index 4ec6ed162..5b87e4859 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -574,14 +574,13 @@ WifiRemoteStationManager::GetAffiliatedStaAddress(const Mac48Address& mldAddress { auto stateIt = m_states.find(mldAddress); - if (stateIt == m_states.end()) + if (stateIt == m_states.end() || !stateIt->second->m_mldAddress) { // MLD address not found - return std::optional(); + return std::nullopt; } - NS_ASSERT(stateIt->second->m_mldAddress.has_value() && - *stateIt->second->m_mldAddress == mldAddress); + NS_ASSERT(*stateIt->second->m_mldAddress == mldAddress); return stateIt->second->m_address; }