Do you mean to check if this local variable is null? Also you set isVisited to false so, unless I'm missing something, this test does nothing.