Skip to content

Commit

Permalink
guard against crash on blank fields
Browse files Browse the repository at this point in the history
  • Loading branch information
KunJeongPark committed Dec 20, 2024
1 parent 461d937 commit 48a5253
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/CardPaySheet/CardFormViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ class CardFormViewController: UIViewController {
}

@objc private func handleContinueButton() {
guard let cardNumber = cardForm.cardNumber, let expirationDate = cardForm.expiryDate, let cvv = cardForm.expiryDate else {
// handle error
return
}

if cardNumber.isEmpty || expirationDate.isEmpty || cvv.isEmpty {
// handle error
return
}

let card = Card.createCard(
cardNumber: cardForm.cardNumber ?? "",
expirationDate: cardForm.expiryDate ?? "",
Expand Down

0 comments on commit 48a5253

Please sign in to comment.