Rather than check for a nil pointer in *t_curpath, you should use the bool return value to check whether it was successful.