src/lib.rs in faster_path-0.0.2 vs src/lib.rs in faster_path-0.0.3
- old
+ new
@@ -18,12 +18,12 @@
assert!(!string.is_null());
CStr::from_ptr(string)
};
- let r_str = str::from_utf8(c_str.to_bytes()).unwrap();
+ let r_str = str::from_utf8(c_str.to_bytes()).unwrap_or("");
- r_str.chars().next().unwrap() == MAIN_SEPARATOR
+ r_str.chars().next().unwrap_or("muffins".chars().next().unwrap()) == MAIN_SEPARATOR
}
#[no_mangle]
pub extern fn is_blank(string: *const c_char) -> bool {
let c_str = unsafe {