diff --git a/src/grt/src/fastroute/src/maze3D.cpp b/src/grt/src/fastroute/src/maze3D.cpp index df101c2d848..dacd20ddd86 100644 --- a/src/grt/src/fastroute/src/maze3D.cpp +++ b/src/grt/src/fastroute/src/maze3D.cpp @@ -397,9 +397,11 @@ int FastRouteCore::copyGrids3D(std::vector& treenodes, const int n1l = treenodes[n1].botL; const int routelen = treeedges[edge_n1n2].route.routelen; - gridsX_n1n2.reserve(routelen + 1); - gridsY_n1n2.reserve(routelen + 1); - gridsL_n1n2.reserve(routelen + 1); + if (routelen > 0) { + gridsX_n1n2.reserve(routelen + 1); + gridsY_n1n2.reserve(routelen + 1); + gridsL_n1n2.reserve(routelen + 1); + } int cnt = 0; if (treeedges[edge_n1n2].n1 == n1) { // n1 is the first node of (n1, n2)