Fix crash when canceling connect.