diff --git a/src/codec/codec.rs b/src/codec/codec.rs index 39f1baf..66eeb3c 100644 --- a/src/codec/codec.rs +++ b/src/codec/codec.rs @@ -41,7 +41,14 @@ impl Codec { } pub fn description(&self) -> &str { - unsafe { from_utf8_unchecked(CStr::from_ptr((*self.as_ptr()).long_name).to_bytes()) } + unsafe { + let long_name = (*self.as_ptr()).long_name; + if long_name.is_null() { + "" + } else { + from_utf8_unchecked(CStr::from_ptr(long_name).to_bytes()) + } + } } pub fn medium(&self) -> media::Type {