relay: fix up NPE when connection is not present