diff --git a/src/block/block.cpp b/src/block/block.cpp index 96fcc3069..c8b15b7bb 100644 --- a/src/block/block.cpp +++ b/src/block/block.cpp @@ -132,10 +132,13 @@ void Block::update_diffpairs() } for (auto &it : nets) { if (it.second.diffpair_primary) { - if (nets.count(it.second.diffpair.uuid)) + if (nets.count(it.second.diffpair.uuid)) { it.second.diffpair->diffpair = &it.second; - else + } + else { it.second.diffpair = nullptr; + it.second.diffpair_primary = false; + } } } } diff --git a/src/block/net.cpp b/src/block/net.cpp index 949d945b9..c2de1b22e 100644 --- a/src/block/net.cpp +++ b/src/block/net.cpp @@ -55,7 +55,7 @@ json Net::serialize() const j["net_class"] = net_class->uuid; j["power_symbol_name_visible"] = power_symbol_name_visible; j["power_symbol_style"] = power_symbol_style_lut.lookup_reverse(power_symbol_style); - if (diffpair_primary) + if (diffpair_primary && diffpair) j["diffpair"] = diffpair->uuid; j["is_port"] = is_port; j["port_direction"] = Pin::direction_lut.lookup_reverse(port_direction); diff --git a/src/router/pns_horizon_iface.cpp b/src/router/pns_horizon_iface.cpp index d49eb50d7..bd52e5aaa 100644 --- a/src/router/pns_horizon_iface.cpp +++ b/src/router/pns_horizon_iface.cpp @@ -304,7 +304,7 @@ bool PNS_HORIZON_RULE_RESOLVER::DpNetPair(const PNS::ITEM *aItem, int &aNetP, in return false; auto net = m_iface->get_net_for_code(aItem->Net()); if (net->diffpair) { - if (net->diffpair_primary) { + if (net->diffpair_primary && net->diffpair) { aNetP = m_iface->get_net_code(net->uuid); aNetN = m_iface->get_net_code(net->diffpair->uuid); }