We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ac7970 commit a6dee1aCopy full SHA for a6dee1a
src/error.rs
@@ -58,8 +58,8 @@ impl Error {
58
59
unsafe fn from_raw(code: c_int, ptr: *const raw::git_error) -> Error {
60
let msg = CStr::from_ptr((*ptr).message as *const _).to_bytes();
61
- let msg = str::from_utf8(msg).unwrap();
62
- Error { code: code, klass: (*ptr).klass, message: msg.to_string() }
+ let msg = String::from_utf8_lossy(msg).into_owned();
+ Error { code: code, klass: (*ptr).klass, message: msg }
63
}
64
65
/// Creates a new error from the given string as the error.
0 commit comments