From 3d0facf1192ca38e5326ff088c585dfc86b63dc2 Mon Sep 17 00:00:00 2001 From: gatecat Date: Tue, 6 Jul 2021 11:34:14 +0100 Subject: design_utils: Fix memory error Signed-off-by: gatecat --- common/design_utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/design_utils.cc b/common/design_utils.cc index a892feaa..da5decf9 100644 --- a/common/design_utils.cc +++ b/common/design_utils.cc @@ -161,7 +161,8 @@ void rename_net(Context *ctx, NetInfo *net, IdString new_name) if (net == nullptr) return; NPNR_ASSERT(!ctx->nets.count(new_name)); - std::swap(ctx->nets[net->name], ctx->nets[new_name]); + ctx->nets[new_name]; + std::swap(ctx->nets.at(net->name), ctx->nets.at(new_name)); ctx->nets.erase(net->name); net->name = new_name; } -- cgit v1.2.3