Commit b7ab8330 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Make sure that the context is not null

parent 32ebc5e8
......@@ -1353,7 +1353,13 @@ bool amf_n1::generate_authentication_vector() {
//------------------------------------------------------------------------------
bool amf_n1::is_amf_ue_id_2_nas_context(const long& amf_ue_ngap_id) const {
std::shared_lock lock(m_amfueid2nas_context);
return bool{amfueid2nas_context.count(amf_ue_ngap_id) > 0};
// return bool{amfueid2nas_context.count(amf_ue_ngap_id) > 0};
if (amfueid2nas_context.count(amf_ue_ngap_id) > 0) {
if (amfueid2nas_context.at(amf_ue_ngap_id).get() != nullptr) {
return true;
}
}
return false;
}
//------------------------------------------------------------------------------
......@@ -1379,7 +1385,13 @@ void amf_n1::remove_amf_ue_ngap_id_2_nas_context(const long& amf_ue_ngap_id) {
//------------------------------------------------------------------------------
bool amf_n1::is_guti_2_nas_context(const std::string& guti) const {
std::shared_lock lock(m_guti2nas_context);
return bool{guti2nas_context.count(guti) > 0};
// return bool{guti2nas_context.count(guti) > 0};
if (guti2nas_context.count(guti) > 0) {
if (guti2nas_context.at(guti).get() != nullptr) {
return true;
}
}
return false;
}
//------------------------------------------------------------------------------
......
......@@ -2140,7 +2140,14 @@ void amf_n2::send_handover_preparation_failure(
bool amf_n2::is_ran_ue_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id) const {
std::shared_lock lock(m_ranid2uecontext);
return bool{ranid2uecontext.count(ran_ue_ngap_id) > 0};
if (ranid2uecontext.count(ran_ue_ngap_id) > 0) {
if (ranid2uecontext.at(ran_ue_ngap_id).get() != nullptr) {
return true;
}
}
return false;
// return bool{ranid2uecontext.count(ran_ue_ngap_id) > 0};
}
//------------------------------------------------------------------------------
......@@ -2168,7 +2175,13 @@ std::shared_ptr<ue_ngap_context> amf_n2::amf_ue_id_2_ue_ngap_context(
bool amf_n2::is_amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id) const {
std::shared_lock lock(m_amfueid2uecontext);
return bool{amfueid2uecontext.count(amf_ue_ngap_id) > 0};
// return bool{amfueid2uecontext.count(amf_ue_ngap_id) > 0};
if (amfueid2uecontext.count(amf_ue_ngap_id) > 0) {
if (amfueid2uecontext.at(amf_ue_ngap_id).get() != nullptr) {
return true;
}
}
return false;
}
//------------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment