Skip to content

Commit

Permalink
Fix macro expansion errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneToIgnore committed Oct 16, 2023
1 parent eab8ece commit 784cef8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,8 @@ impl Graphics {
let c_path = CString::new(path).map_err(Error::msg)?;
let mut out_err: *const crankstart_sys::ctypes::c_char = ptr::null_mut();
let font = pd_func_caller!((*self.0).loadFont, c_path.as_ptr(), &mut out_err)?;
if font == ptr::null_mut() {
if out_err != ptr::null_mut() {
if font.is_null() {
if !out_err.is_null() {
let err_msg = unsafe { CStr::from_ptr(out_err).to_string_lossy().into_owned() };
Err(anyhow!(err_msg))
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl<T: 'static + Game> GameRunner<T> {
#[macro_export]
macro_rules! crankstart_game {
($game_struct:tt) => {
crankstart_game!($game_struct, PDSystemEvent::kEventInit)
crankstart_game!($game_struct, PDSystemEvent::kEventInit);
};
($game_struct:tt, $pd_system_event:expr) => {
pub mod game_setup {
Expand Down
2 changes: 1 addition & 1 deletion src/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Lua {
let c_name = CString::new(name).map_err(Error::msg)?;
let mut out_err: *const crankstart_sys::ctypes::c_char = ptr::null_mut();
pd_func_caller!((*self.0).addFunction, f, c_name.as_ptr(), &mut out_err)?;
if out_err != ptr::null_mut() {
if !out_err.is_null() {
let err_msg = unsafe { CStr::from_ptr(out_err).to_string_lossy().into_owned() };
Err(anyhow!(err_msg))
} else {
Expand Down

0 comments on commit 784cef8

Please sign in to comment.