We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 383f5fa commit d4d2b34Copy full SHA for d4d2b34
src/archive.rs
@@ -161,10 +161,16 @@ pub trait Entry {
161
unsafe { ffi::archive_entry_size(self.entry()) }
162
}
163
164
- fn symlink(&self) -> &str {
165
- let c_str: &CStr = unsafe { CStr::from_ptr(ffi::archive_entry_symlink(self.entry())) };
+ fn symlink(&self) -> Option<&str> {
+ let c_str: &CStr = unsafe {
166
+ let ptr = ffi::archive_entry_symlink(self.entry());
167
+ if ptr.is_null() {
168
+ return None;
169
+ }
170
+ CStr::from_ptr(ptr)
171
+ };
172
let buf: &[u8] = c_str.to_bytes();
- str::from_utf8(buf).unwrap()
173
+ Some(str::from_utf8(buf).unwrap())
174
175
176
fn set_filetype(&mut self, file_type: FileType) {
0 commit comments