fix: check primary_selection_manager_state

This commit is contained in:
Ashley Wulber 2024-02-28 15:46:50 -05:00
parent 0d61c088e5
commit 7da622c80b
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820

View file

@ -64,10 +64,21 @@ fn worker_impl(
Command::Store(data, target) => {
state.store_selection(target, data);
},
Command::Load(mime_types, target)
Command::Load(mime_types, SelectionTarget::Clipboard)
if state.data_device_manager_state.is_some() =>
{
if let Err(err) = state.load_selection(target, &mime_types) {
if let Err(err) =
state.load_selection(SelectionTarget::Clipboard, &mime_types)
{
let _ = state.reply_tx.send(Err(err));
}
},
Command::Load(mime_types, SelectionTarget::Primary)
if state.primary_selection_manager_state.is_some() =>
{
if let Err(err) =
state.load_selection(SelectionTarget::Primary, &mime_types)
{
let _ = state.reply_tx.send(Err(err));
}
},