ttcn3: fix uncaught exception in SS

fix accessing child element in parsed Json without checking
its existence.
master
Andre Puschmann 4 years ago
parent 8df388ba3e
commit 3088cdbb0f

@ -104,7 +104,7 @@ private:
++itr) { ++itr) {
assert(itr->HasMember("PduSduList")); assert(itr->HasMember("PduSduList"));
assert((*itr)["PduSduList"].IsObject()); assert((*itr)["PduSduList"].IsObject());
assert((*itr)["PduSduList"].HasMember("PdcpSdu")); if ((*itr)["PduSduList"].HasMember("PdcpSdu")) {
assert((*itr)["PduSduList"]["PdcpSdu"].IsArray()); assert((*itr)["PduSduList"]["PdcpSdu"].IsArray());
const Value& sdulist = (*itr)["PduSduList"]["PdcpSdu"]; const Value& sdulist = (*itr)["PduSduList"]["PdcpSdu"];
for (Value::ConstValueIterator sdu_itr = sdulist.Begin(); sdu_itr != sdulist.End(); ++sdu_itr) { for (Value::ConstValueIterator sdu_itr = sdulist.Begin(); sdu_itr != sdulist.End(); ++sdu_itr) {
@ -114,6 +114,11 @@ private:
octstr.from_string(sdustr); octstr.from_string(sdustr);
handle_sdu(document, lcid, octstr.data(), octstr.size(), ttcn3_helpers::get_follow_on_flag(document)); handle_sdu(document, lcid, octstr.data(), octstr.size(), ttcn3_helpers::get_follow_on_flag(document));
} }
} else if ((*itr)["PduSduList"].HasMember("MacPdu")) {
log->warning("Not handling MacPdu type.");
} else {
log->warning("Not handling this PduSdu type.\n");
}
} }
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;

@ -374,12 +374,14 @@ private:
const Value& config = (*itr)["Config"]; const Value& config = (*itr)["Config"];
if (config.HasMember("AddOrReconfigure")) { if (config.HasMember("AddOrReconfigure")) {
const Value& aor = config["AddOrReconfigure"]; const Value& aor = config["AddOrReconfigure"];
if (aor.HasMember("LogicalChannelId")) {
uint32_t lcid = aor["LogicalChannelId"].GetInt(); uint32_t lcid = aor["LogicalChannelId"].GetInt();
if (lcid > 0) { if (lcid > 0) {
pdcp_config_t pdcp_cfg = make_drb_pdcp_config_t(static_cast<uint8_t>(lcid), false); pdcp_config_t pdcp_cfg = make_drb_pdcp_config_t(static_cast<uint8_t>(lcid), false);
syssim->add_drb( syssim->add_drb(
ttcn3_helpers::get_timing_info(document), ttcn3_helpers::get_cell_name(document), lcid, pdcp_cfg); ttcn3_helpers::get_timing_info(document), ttcn3_helpers::get_cell_name(document), lcid, pdcp_cfg);
} }
}
} else if (config.HasMember("Release")) { } else if (config.HasMember("Release")) {
uint32_t lcid = id["Drb"].GetInt() + 2; uint32_t lcid = id["Drb"].GetInt() + 2;
syssim->del_drb(ttcn3_helpers::get_timing_info(document), ttcn3_helpers::get_cell_name(document), lcid); syssim->del_drb(ttcn3_helpers::get_timing_info(document), ttcn3_helpers::get_cell_name(document), lcid);

Loading…
Cancel
Save