[connectionagent] fix crash accessing NULL object