Fixed null object bug

I fixed a bug that occurred when the A* algorithm is not used for moving
a unit.