pub fn get(&self) -> String {
unsafe {
let cstr = ui_text_get(self.ptr);
- CStr::from_ptr(cstr)
- .to_string_lossy()
- .into_owned()
+ if !cstr.is_null() {
+ CStr::from_ptr(cstr)
+ .to_string_lossy()
+ .into_owned()
+ } else {
+ "".to_owned()
+ }
}
}
pub fn get(&self) -> String {
unsafe {
let cstr = ui_string_get(self.ptr);
- CStr::from_ptr(cstr)
- .to_string_lossy()
- .into_owned()
+ if !cstr.is_null() {
+ CStr::from_ptr(cstr)
+ .to_string_lossy()
+ .into_owned()
+ } else {
+ "".to_owned()
+ }
}
}