Skip to content

Commit 87681c9

Browse files
author
osamahammad21
committed
odb: guard optional dbId getters against invalid id resolution
Signed-off-by: osamahammad21 <osama@precisioninno.com>
1 parent 4c26918 commit 87681c9

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/odb/src/db/dbMetalWidthViaMap.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ bool dbMetalWidthViaMap::isPgVia() const
209209
dbTechLayer* dbMetalWidthViaMap::getCutLayer() const
210210
{
211211
_dbMetalWidthViaMap* obj = (_dbMetalWidthViaMap*) this;
212+
if (!obj->cut_layer_.isValid()) {
213+
return nullptr;
214+
}
212215
dbTech* tech = (dbTech*) obj->getOwner();
213216
return dbTechLayer::getTechLayer(tech, obj->cut_layer_);
214217
}

src/odb/src/db/dbTechLayerAreaRule.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ void dbTechLayerAreaRule::setTrimLayer(dbTechLayer* trim_layer)
276276
dbTechLayer* dbTechLayerAreaRule::getTrimLayer() const
277277
{
278278
_dbTechLayerAreaRule* obj = (_dbTechLayerAreaRule*) this;
279+
if (!obj->trim_layer_.isValid()) {
280+
return nullptr;
281+
}
279282
odb::dbTech* tech = getDb()->getTech();
280283
return odb::dbTechLayer::getTechLayer(tech, obj->trim_layer_);
281284
}

0 commit comments

Comments
 (0)