Check for -1 instead of null pointer when validating path