Fix if logic for empty links