Computer use CLI for AI agents
Rust accessibilityaccessibility-apiai-agentsautomationclicomputer-usecomputer-use-agentcomputer-use-agentsdesktop-automationmacosmcprust
fix(macos): harden retained_handle null guard against release-only CFRetain(null) (#80)
Lahfira708fa03326a
diff --git a/crates/macos/src/tree/resolve_classify.rs b/crates/macos/src/tree/resolve_classify.rsindex 1618e72e6..5527bf535 100644--- a/crates/macos/src/tree/resolve_classify.rs+++ b/crates/macos/src/tree/resolve_classify.rs@@ -84,9 +84,11 @@ fn text_len(value: Option<&str>) -> usize {#[cfg(target_os = "macos")]fn retained_handle(candidate: AXElement) -> Result<NativeHandle, AdapterError> {use core_foundation::base::{CFRetain, CFTypeRef};- #[cfg(test)]if candidate.0.is_null() {+ #[cfg(test)]return Ok(NativeHandle::null());+ #[cfg(not(test))]+ return Err(AdapterError::element_not_found("element"));}unsafe { CFRetain(candidate.0 as CFTypeRef) };Ok(unsafe { NativeHandle::from_ptr(candidate.0 as *const _) })