Skip to content

Commit

Permalink
Perform checks in advance to avoid a panic. (#586)
Browse files Browse the repository at this point in the history
* Perform checks in advance to avoid a panic.

* fmt
  • Loading branch information
jm-observer authored Sep 23, 2024
1 parent 16224ea commit 7a128a5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ impl Clipboard {
}

pub fn set_contents(s: String) -> Result<(), ClipboardError> {
if s.is_empty() {
return Err(ClipboardError::ProviderError(
"content is empty".to_string(),
));
}
CLIPBOARD
.lock()
.as_mut()
Expand Down

0 comments on commit 7a128a5

Please sign in to comment.