Skip to content

Commit 5a9a438

Browse files
committed
grt/cugr: use find in access-point getters to avoid out_of_range on unregistered nets
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
1 parent ee9ae4f commit 5a9a438

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/grt/src/cugr/src/CUGR.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,13 @@ void CUGR::getITermsAccessPoints(
12231223
odb::dbNet* net,
12241224
odb::PtrMap<odb::dbITerm, odb::Point3D>& access_points)
12251225
{
1226-
GRNet* gr_net = db_net_map_.at(net);
1226+
// Nets absent from the map (e.g. < 2 pins, skipped by updateNet) have no
1227+
// CUGR access points; leave the output empty.
1228+
auto it = db_net_map_.find(net);
1229+
if (it == db_net_map_.end()) {
1230+
return;
1231+
}
1232+
GRNet* gr_net = it->second;
12271233
for (const auto& [iterm, ap] : gr_net->getITermAccessPoints()) {
12281234
const int x = grid_graph_->getGridline(0, ap.point.x());
12291235
const int y = grid_graph_->getGridline(1, ap.point.y());
@@ -1235,7 +1241,11 @@ void CUGR::getBTermsAccessPoints(
12351241
odb::dbNet* net,
12361242
odb::PtrMap<odb::dbBTerm, odb::Point3D>& access_points)
12371243
{
1238-
GRNet* gr_net = db_net_map_.at(net);
1244+
auto it = db_net_map_.find(net);
1245+
if (it == db_net_map_.end()) {
1246+
return;
1247+
}
1248+
GRNet* gr_net = it->second;
12391249
for (const auto& [bterm, ap] : gr_net->getBTermAccessPoints()) {
12401250
const int x = grid_graph_->getGridline(0, ap.point.x());
12411251
const int y = grid_graph_->getGridline(1, ap.point.y());

0 commit comments

Comments
 (0)