summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authortanakalian <132448622+tanakalian@users.noreply.github.com>2023-05-04 01:28:19 +0100
committerKyleMiles <krm504@nyu.edu>2023-05-10 17:45:08 -0400
commitdfd2b29120baa6d86ab6e76ab5f940dec63ffe37 (patch)
tree4f71873c45b8641c8b174c975af1d438e91b8990 /rust
parentaa521332118de67884e2ae4e7d0e0e674dab759d (diff)
Fixed calling open_view on a bndb with an invalid view would panic as unwrap was called. Fixed by matching to handle the error case
Diffstat (limited to 'rust')
-rw-r--r--rust/src/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 61358e6c..aa4f7efb 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -234,7 +234,10 @@ pub fn open_view<F: AsRef<Path>>(filename: F) -> Result<rc::Ref<binaryview::Bina
if available_view.name().as_str() == "Raw" {
None
} else if is_bndb {
- Some(view.file().get_view_of_type(available_view.name()).unwrap())
+ match view.file().get_view_of_type(available_view.name()){
+ Ok(view) => Some(view),
+ _ => None
+ }
} else {
// TODO : add log prints
println!("Opening view of type: `{}`", available_view.name());