diff --git a/examples/pasteboard/nspasteboard.rs b/examples/pasteboard/nspasteboard.rs index 58990ba31..f39b285ee 100644 --- a/examples/pasteboard/nspasteboard.rs +++ b/examples/pasteboard/nspasteboard.rs @@ -23,7 +23,7 @@ pub fn get_text_2(pasteboard: &NSPasteboard) -> Option> { let obj = objects?.firstObject()?; // We now have to convert the object into an NSString, which we know it to // be since that's what we told `readObjectsForClasses:options:` we wanted. - Some(obj.downcast::().unwrap()) + obj.downcast::().ok() } pub fn set_text(pasteboard: &NSPasteboard, text: &NSString) {