Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle no payload #421

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading