From cf142de2db69c78996774ce21e8839243160a0fd Mon Sep 17 00:00:00 2001 From: hadiesna Date: Wed, 5 May 2021 16:03:27 +0430 Subject: [PATCH] change panic to return --- src/lib.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7482032..3fd3dd7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 {