Merge pull request #12 from mrmekon/scrubber_crash
Fix scrubber crash
[package]
name = "rubrail"
-version = "0.4.4-rc"
+version = "0.5.1-rc"
authors = ["Trevor Bentley <mrmekon@gmail.com>"]
description = "Rubrail is a Rust library for interfacing with the Mac Touch Bar"
keywords = ["macos", "touchbar", "osx", "mac"]
objc_id = "0.1"
[dependencies.fruitbasket]
-version = "0.4"
+version = "0.5"
features = ["logging"]
[target."cfg(target_os = \"macos\")".dependencies.objc]
let item = *scrub_id as *mut Object;
let scrubber: *mut Object = msg_send![item, view];
let sel_idx: i32 = msg_send![scrubber, selectedIndex];
+ let pre_count: i32 = msg_send![scrubber, numberOfItems];
let _:() = msg_send![scrubber, reloadData];
+ let post_count: i32 = msg_send![scrubber, numberOfItems];
// reload clears the selected item. re-select it.
- if sel_idx >= 0 {
+ if sel_idx >= 0 && pre_count == post_count {
let _:() = msg_send![scrubber, setSelectedIndex: sel_idx];
}
}