Sometimes, links resolve partially to node objects. That is, some links become node objects, some do not. Hence, check every link independently.