Skip to content

Commit 4652e58

Browse files
author
Stephan Dilly
committed
we can expect non-utf8 strings in tracing messages
1 parent c7025a7 commit 4652e58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tracing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ extern "C" fn tracing_cb_c(level: raw::git_trace_level_t, msg: *const c_char) {
7676
let cb = CALLBACK.load(Ordering::SeqCst);
7777
panic::wrap(|| unsafe {
7878
let cb: TracingCb = std::mem::transmute(cb);
79-
let msg = std::ffi::CStr::from_ptr(msg).to_str().unwrap();
80-
cb(Binding::from_raw(level), msg);
79+
let msg = std::ffi::CStr::from_ptr(msg).to_string_lossy();
80+
cb(Binding::from_raw(level), msg.as_ref());
8181
});
8282
}

0 commit comments

Comments
 (0)