Skip to content

Commit

Permalink
Add null check after metadata object type check
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekrnv committed Sep 19, 2024
1 parent 9735f87 commit 8d1db6c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions orchagent/saihelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,12 @@ std::vector<sai_stat_id_t> queryAvailableCounterStats(const sai_object_type_t ob
std::vector<sai_stat_id_t> stat_list;
auto info = sai_metadata_get_object_type_info(object_type);

if (!info)
{
SWSS_LOG_ERROR("Metadata info query failed, invalid object: %d", object_type);
return stat_list;
}

SWSS_LOG_NOTICE("SAI object %s supports stat type %s",
sai_serialize_object_type(object_type).c_str(),
info->statenum->name);
Expand Down

0 comments on commit 8d1db6c

Please sign in to comment.