Skip to content

Commit

Permalink
change panic to return
Browse files Browse the repository at this point in the history
  • Loading branch information
HadiEsna committed May 5, 2021
1 parent 44a7a07 commit cf142de
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1272,11 +1272,10 @@ pub mod subscrypt {
provider_address: AccountId,
plan_index: u128,
) -> bool {
let user = match self.username_to_address.get(&username) {
Some(name) => *name,
None => panic!("this username is invalid!"),
};
self.check_subscription(user, provider_address, plan_index)
match self.username_to_address.get(&username) {
Some(name) => self.check_subscription(*name, provider_address, plan_index),
None => false,
}
}

fn retrieve_whole_data(&self, caller: AccountId) -> Vec<SubscriptionRecord> {
Expand Down

0 comments on commit cf142de

Please sign in to comment.