From 26ed2cdfb13591c63a52e978ead5eae0b6acb0c4 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sat, 25 Jan 2025 02:19:29 -0500 Subject: Fix collaboration support checks in rust unit tests --- rust/src/collaboration.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'rust/src') diff --git a/rust/src/collaboration.rs b/rust/src/collaboration.rs index 1dce8104..e173afaa 100644 --- a/rust/src/collaboration.rs +++ b/rust/src/collaboration.rs @@ -36,6 +36,16 @@ use crate::string::{BnStrCompatible, BnString}; // TODO: on what functions need to have been called prior? I feel like we should make the user have to pull // TODO: the data because they have a greater understanding of where the function is being called from. +/// Check whether the client has collaboration support. +/// +/// Call this if you intend on providing divergent behavior, as otherwise you will likely +/// crash calling collaboration APIs on unsupported builds of Binary Ninja. +pub fn has_collaboration_support() -> bool { + let mut count = 0; + let value = unsafe { BNCollaborationGetRemotes(&mut count) }; + !value.is_null() +} + /// Get the single actively connected Remote (for ux simplification), if any pub fn active_remote() -> Option> { let value = unsafe { BNCollaborationGetActiveRemote() }; -- cgit v1.3.1