diff --git a/flatland/utils/rendertools.py b/flatland/utils/rendertools.py
index 5ec756f98c2229110e2bfc4cc146f83522eee3bc..c7118dd2d3bb962a2ac440de8dd67343191689ff 100644
--- a/flatland/utils/rendertools.py
+++ b/flatland/utils/rendertools.py
@@ -286,7 +286,7 @@ class RenderTool(object):
         if visitDest is not None:
             visit = visitDest
             xyPrev = None
-            while visit.prev is not None:
+            while visit is not None:
                 xy = np.matmul(visit.rc, rt.grc2xy) + rt.xyHalf
                 if xyPrev is not None:
                     dx, dy = (xyPrev - xy) / 20