Skip to content

Commit f5fb3b2

Browse files
committed
High-level API: Fix build
1 parent fad3659 commit f5fb3b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

main/high/src/reaper_simple.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//! This file should contain all the top-level REAPER functions which can be implemented with
22
//! just access to `reaper_medium::Reaper` - without all the advanced stuff like subjects,
33
//! channels etc. Although they end up in the same struct, this gives a little bit of structure.
4+
use crate::error::ReaperResult;
45
use crate::{
56
Action, Fx, FxChain, FxParameter, Guid, MidiInputDevice, MidiOutputDevice, Project, Reaper,
6-
Section,
7+
ReaperError, Section,
78
};
89
use camino::Utf8PathBuf;
910
use helgoboss_midi::ShortMessage;
@@ -471,9 +472,11 @@ impl Reaper {
471472
let config_var_result = Reaper::get()
472473
.medium_reaper
473474
.get_config_var(name)
474-
.context("preference doesn't exist")?;
475+
.ok_or(ReaperError::new("preference doesn't exist"))?;
475476
let size_matches = config_var_result.size as usize == mem::size_of::<T>();
476-
ensure!(size_matches, "size mismatch");
477+
if !size_matches {
478+
return Err("size mismatch".into());
479+
}
477480
let mut casted_value_ptr = config_var_result.value.cast::<T>();
478481
let casted_value_ref = unsafe { casted_value_ptr.as_mut() };
479482
Ok(casted_value_ref)

0 commit comments

Comments
 (0)