[api] don't crash if a linked_to package is no longer there