variable returns null

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MikeyZman

Hi All, thanks in advance for any help. How can I troubleshoot the following code where I am getting seemingly valid numbers for closest_end_point and closest_start_point and stone_graph? path returns null for some reason.

the upstream values that lead to closest_start_point , closest_end_point and stone_graph all seem good coming in. and the returns from the print statements (troubleshooting) are:
11 (closest_end_point)
62 (closest_start_point)
[AStar:1213] (stone_graph is generated with an AStar call.
(path return, which is null and blowing up my program…)

anyone got any ideas how I can troubleshoot?

var closest_start_point = stone_graph.get_closest_point(start_position)
var closest_end_point = stone_graph.get_closest_point(end_position)
print (closest_end_point)
print (closest_start_point)
var path = stone_graph.get_point_path(closest_start_point, closest_end_point)

Here is where stone_graph is generated in a higher function that calls the code above’s function:

var stone_graph =
:bust_in_silhouette: Reply From: MikeyZman

I found my problem, it was much higher than this.

I don’t know if there was a way to troubleshoot this at the level I was attempting, there is just no information, other than path was returning as null, so something up above was bad.

I looked at my stone_graph variable, and since there’s no information from a print, I followed it along and found that some of the points I was asking it to track simply didn’t exist because of a name that I got wrong for a tile. The tile name I gave it was legal and so no errors it was just the wrong one and this trickled down to where the null array revealed itself.