src/is_directory.rs in faster_path-0.1.7 vs src/is_directory.rs in faster_path-0.1.8
- old
+ new
@@ -4,11 +4,12 @@
use std::path::Path;
#[no_mangle]
pub extern fn is_directory(string: *const c_char) -> bool {
let c_str = unsafe {
- assert!(!string.is_null());
-
+ if string.is_null() {
+ return false;
+ }
CStr::from_ptr(string)
};
let r_str = str::from_utf8(c_str.to_bytes()).unwrap_or("");