Skip to content

Commit

Permalink
Merge pull request #75 from SomeoneToIgnore/fix-macro-error
Browse files Browse the repository at this point in the history
Fix macro expansion errors
  • Loading branch information
boozook authored Oct 26, 2023
2 parents eab8ece + 784cef8 commit 32806a5
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 32806a5

Please sign in to comment.