Hi,

I just noticed that a couple of exceptions are coming in through the cloud analytics dashboard for our game. Both of them are “NullReferenceException: Object reference not set to an instance of an object”.

I’ll attach the two call stacks at the bottom.

We are using a couple of NavMeshCut components, one of them attached to the player so that AI won’t try to walk through them, if they block a narrow pathway. So this NavMeshCut moves around a lot and I suspect in some cases, this causes Poly2Tri to fail. However, I’m not sure about this. Is there anything I can try to reduce the chance of this going wrong? Unfortunately, it is not an easy thing to reproduce since we only very rarely get the error in the editor during development (1 or 2 occasions so far in total).

Could I solve the agents’s pathfinding around the player some other way without using NavMeshCut?

Any help would be much appreciated

Thanks!

I’m on unity 2020.2.0f1 and the package version is 4.2.15.

Here’s call stack #1:

```
Pathfinding.Poly2Tri.DTSweep.FlipEdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle t, Pathfinding.Poly2Tri.TriangulationPoint p) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.FlipEdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle t, Pathfinding.Poly2Tri.TriangulationPoint p) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.EdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle triangle, Pathfinding.Poly2Tri.TriangulationPoint point) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.EdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.DTSweepConstraint edge, Pathfinding.Poly2Tri.AdvancingFrontNode node) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.Sweep (Pathfinding.Poly2Tri.DTSweepContext tcx) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.Triangulate (Pathfinding.Poly2Tri.DTSweepContext tcx) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.P2T.Triangulate (Pathfinding.Poly2Tri.TriangulationContext tcx) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.P2T.Triangulate (Pathfinding.Poly2Tri.TriangulationAlgorithm algorithm, Pathfinding.Poly2Tri.Triangulatable t) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.P2T.Triangulate (Pathfinding.Poly2Tri.Polygon p) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Util.TileHandler.CutPoly (Pathfinding.Int3[] verts, System.Int32[] tris, Pathfinding.Int3[] extraShape, Pathfinding.Util.GraphTransform graphTransform, Pathfinding.IntRect tiles, Pathfinding.Util.TileHandler+CutMode mode, System.Int32 perturbate) (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
Pathfinding.Util.TileHandler+<>c__DisplayClass41_0.<LoadTile>b__0 (Pathfinding.IWorkItemContext context, System.Boolean force) (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
Pathfinding.WorkItemProcessor.ProcessWorkItems (System.Boolean force) (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
AstarPath.PerformBlockingActions (System.Boolean force) (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
AstarPath.Update () (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
```

And here’s the slightly different call stack #2:

```
Pathfinding.Poly2Tri.DTSweep.FlipScanEdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle flipTriangle, Pathfinding.Poly2Tri.DelaunayTriangle t, Pathfinding.Poly2Tri.TriangulationPoint p) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.FlipEdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle t, Pathfinding.Poly2Tri.TriangulationPoint p) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.FlipEdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle t, Pathfinding.Poly2Tri.TriangulationPoint p) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.EdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle triangle, Pathfinding.Poly2Tri.TriangulationPoint point) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.EdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.DTSweepConstraint edge, Pathfinding.Poly2Tri.AdvancingFrontNode node) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.Sweep (Pathfinding.Poly2Tri.DTSweepContext tcx) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.DTSweep.Triangulate (Pathfinding.Poly2Tri.DTSweepContext tcx) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.P2T.Triangulate (Pathfinding.Poly2Tri.TriangulationContext tcx) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.P2T.Triangulate (Pathfinding.Poly2Tri.TriangulationAlgorithm algorithm, Pathfinding.Poly2Tri.Triangulatable t) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Poly2Tri.P2T.Triangulate (Pathfinding.Poly2Tri.Polygon p) (at <07aca9e84ffe412bbfb50d0962eb64f2>:0)
Pathfinding.Util.TileHandler.CutPoly (Pathfinding.Int3[] verts, System.Int32[] tris, Pathfinding.Int3[] extraShape, Pathfinding.Util.GraphTransform graphTransform, Pathfinding.IntRect tiles, Pathfinding.Util.TileHandler+CutMode mode, System.Int32 perturbate) (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
Pathfinding.Util.TileHandler+<>c__DisplayClass41_0.<LoadTile>b__0 (Pathfinding.IWorkItemContext context, System.Boolean force) (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
Pathfinding.WorkItemProcessor.ProcessWorkItems (System.Boolean force) (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
AstarPath.PerformBlockingActions (System.Boolean force) (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
AstarPath.Update () (at <a06ec6d629b7444ebaeffc0f8bc4c221>:0)
```