[connectionagent] fix crash trying to delete uninitialized object