         enableProgressiveButton(areRequiredFieldsPopulated())
         guard
             displayMode == .shortNumeric,
-            let text = sender.text,
-            text.characters.count > 0
+            sender.text.wmf_safeCharacterCount > 0
         else {
             return
         }

        }
        
        // Enforce max count.
        let countIfAllowed = (textField.text ?? "" + string).characters.count
        return (countIfAllowed < maxTextFieldCharacterCount())
    }
    
    func textFieldDidBeginEditing(_ textField: UITextField) {

    fileprivate func areRequiredFieldsPopulated() -> Bool {
        switch displayMode {
        case .longAlphaNumeric:
            guard backupOathTokenField.text.wmf_safeCharacterCount > 0 else {
                return false
            }
            return true
        case .shortNumeric:
            return oathTokenFields.first(where:{ $0.text.wmf_safeCharacterCount == 0 }) == nil
        }
    }
    
