Fix crash when dismissing connect dialog.