summaryrefslogtreecommitdiff
path: root/rust/src/interaction/report.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-10 23:09:10 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commit5ebbd0620903403fb30a61157b16f33c89afb584 (patch)
treede3af288ba6cf0dfc704b72fb23ba199ef9c9cd2 /rust/src/interaction/report.rs
parentd23808b24efdda0e510bb70f8c6ece41e9b4347b (diff)
[Rust] Interaction handler API fixes
Diffstat (limited to 'rust/src/interaction/report.rs')
-rw-r--r--rust/src/interaction/report.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/rust/src/interaction/report.rs b/rust/src/interaction/report.rs
index a20d8f1f..689b815b 100644
--- a/rust/src/interaction/report.rs
+++ b/rust/src/interaction/report.rs
@@ -46,9 +46,12 @@ impl ReportCollection {
Report::new(self, i)
}
- fn view(&self, i: usize) -> Ref<BinaryView> {
+ fn view(&self, i: usize) -> Option<Ref<BinaryView>> {
let raw = unsafe { BNGetReportView(self.handle.as_ptr(), i) };
- unsafe { BinaryView::ref_from_raw(raw) }
+ if raw.is_null() {
+ return None;
+ }
+ Some(unsafe { BinaryView::ref_from_raw(raw) })
}
fn title(&self, i: usize) -> String {
@@ -190,7 +193,7 @@ impl<'a> Report<'a> {
}
}
- pub fn view(&self) -> Ref<BinaryView> {
+ pub fn view(&self) -> Option<Ref<BinaryView>> {
self._inner().view()
}
@@ -253,7 +256,7 @@ impl ReportInner<'_> {
self.collection.report_type(self.index)
}
- fn view(&self) -> Ref<BinaryView> {
+ fn view(&self) -> Option<Ref<BinaryView>> {
self.collection.view(self.index)
}