ip: check for null before ip_get_next_hop is used