SupportLeanbackDemos: Fixed password crash when no payment is selected

am: be98b3af70

* commit 'be98b3af70d0fb280dd688040b04880a9e4d543f':
  SupportLeanbackDemos: Fixed password crash when no payment is selected
This commit is contained in:
Keyvan Amiri
2016-02-10 21:57:59 +00:00
committed by android-build-merger
2 changed files with 8 additions and 4 deletions

View File

@@ -420,8 +420,10 @@ public class GuidedStepActivity extends Activity {
boolean isPaymentValid() {
CharSequence paymentType = findActionById(PAYMENT).getDescription();
return paymentType.subSequence(0, 4).toString().equals("Visa") ||
paymentType.subSequence(0, 6).toString().equals("Master");
return (paymentType.length() >= 4 &&
paymentType.subSequence(0, 4).toString().equals("Visa")) ||
(paymentType.length() >= 6 &&
paymentType.subSequence(0, 6).toString().equals("Master"));
}
boolean isPasswordValid() {

View File

@@ -422,8 +422,10 @@ public class GuidedStepSupportActivity extends FragmentActivity {
boolean isPaymentValid() {
CharSequence paymentType = findActionById(PAYMENT).getDescription();
return paymentType.subSequence(0, 4).toString().equals("Visa") ||
paymentType.subSequence(0, 6).toString().equals("Master");
return (paymentType.length() >= 4 &&
paymentType.subSequence(0, 4).toString().equals("Visa")) ||
(paymentType.length() >= 6 &&
paymentType.subSequence(0, 6).toString().equals("Master"));
}
boolean isPasswordValid() {