Check whether findNearestPoly actually did find a poly

Fixes issue #530 by checking `startRef` and `endRef` after the calls to `findNearestPoly`. Now if NavPath fails to find a path you'll get a warning in the console as usual.