Fixed a NullPointerException bug

Sometimes, so of the paths can be null. So I'm checking for that so the whole thing does not explode