Probably worth a comment as to how you can end up here. Also if this should only happen when out_socket is undefined it may be worth adding that as a condition.