diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 01fe89019..d9a9ed2c9 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -823,7 +823,7 @@ ApWifiMac::GetVhtOperation(uint8_t linkId) const // segment that contains the primary channel. operation.SetChannelCenterFrequencySegment0( (bssBandwidth == 160) - ? phy->GetOperatingChannel().GetPrimaryChannelNumber(80, WIFI_STANDARD_80211ac) + ? phy->GetOperatingChannel().GetPrimaryChannelNumber(80, phy->GetStandard()) : phy->GetChannelNumber()); // For a 20, 40, or 80 MHz BSS bandwidth, this subfield is set to 0. // For a 160 MHz BSS bandwidth and the Channel Width subfield equal to 1, diff --git a/src/wifi/model/wifi-phy-operating-channel.cc b/src/wifi/model/wifi-phy-operating-channel.cc index 2d1bfb906..3c211cd6e 100644 --- a/src/wifi/model/wifi-phy-operating-channel.cc +++ b/src/wifi/model/wifi-phy-operating-channel.cc @@ -512,8 +512,10 @@ WifiPhyOperatingChannel::GetPrimaryChannelNumber(uint16_t primaryChannelWidth, WifiStandard standard) const { auto frequency = GetPrimaryChannelCenterFrequency(primaryChannelWidth); + NS_ASSERT_MSG(IsSet(), "No channel set"); auto& [chanNumber, centerFreq, channelWidth, channelType, band] = *m_channelIt; auto primaryChanIt = FindFirst(0, frequency, primaryChannelWidth, standard, band); + NS_ASSERT_MSG(primaryChanIt != m_frequencyChannels.end(), "Primary channel number not found"); return std::get<0>(*primaryChanIt); }