Don't unwrap in debug code

This commit is contained in:
hodasemi 2023-04-11 08:50:43 +02:00
parent 872c858f9e
commit b4d6644c48

View file

@ -17,8 +17,7 @@ macro_rules! load_function_ptrs {
fn log(msg: impl ToString) {
use std::io::Write;
let home = std::env::var("HOME").unwrap();
if let Ok(home) = std::env::var("HOME") {
let log_file = format!("{}/rf2_vk_hud.log", home);
if let Ok(mut file) = std::fs::OpenOptions::new()
@ -29,6 +28,7 @@ macro_rules! load_function_ptrs {
if let Err(_) = file.write_all(format!("{}\n", msg.to_string()).as_bytes()) {}
}
}
}
pub fn load<F>(mut f: F) -> $struct_name
where F: FnMut(&std::ffi::CStr) -> *const std::os::raw::c_void