Skip to content

Commit

Permalink
Handle no payload (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtso authored Jun 24, 2024
1 parent 41785eb commit 2158e17
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rust/processor/src/utils/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ pub fn ensure_not_negative(val: BigDecimal) -> BigDecimal {
pub fn get_entry_function_from_user_request(
user_request: &UserTransactionRequest,
) -> Option<String> {
let entry_function_id_str: Option<String> =
match &user_request.payload.as_ref().unwrap().payload {
let entry_function_id_str: Option<String> = match &user_request.payload {
Some(txn_payload) => match &txn_payload.payload {
Some(PayloadType::EntryFunctionPayload(payload)) => {
Some(payload.entry_function_id_str.clone())
},
Expand All @@ -127,7 +127,9 @@ pub fn get_entry_function_from_user_request(
}
},
_ => return None,
};
},
None => return None,
};

entry_function_id_str.map(|s| truncate_str(&s, MAX_ENTRY_FUNCTION_LENGTH))
}
Expand Down

0 comments on commit 2158e17

Please sign in to comment.