WhisperSystems/TextSecure-iOS — pull request #81 by troyjfarrell (2014-02-26 05:39:37+00:00)
Title: VerificationViewController issues with blank country codes

This set of commits resolves the bad behavior and exceptions thrown from VerificationViewController when the user leaves the country code text input blank. Specifically, if no country code is set, a certain set of numbers entered by the user can cause an NSRangeException to be raised:

1) Touch the country code field.
2) Touch the phone number field. Note that the country code field contains only '+'.
3) Touch the '2' key until the NSRangeException is raised.

This set of commits adds an NSAssert to make clear the code's assumption that a country code will always be present. It also adds logic to the countryCodeInput UITextInput to restore the previous country code is the input is touched, but no new value is entered.