1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Linux - Fix crash in keyframes

This commit is contained in:
Robert 2024-03-25 20:41:15 +01:00
parent 257fa8ae0d
commit 107b604c86
2 changed files with 15 additions and 16 deletions

View File

@ -250,15 +250,11 @@ public abstract partial class TreeItemViewModel : ActivatableViewModelBase
private async void UpdateCanPaste(bool isFlyoutOpen)
{
string[] formats = await Shared.UI.Clipboard.GetFormatsAsync();
//diogotr7: This can be null on Linux sometimes. I'm not sure why.
if (formats == null!)
{
CanPaste = false;
return;
}
string[]? formats = await Shared.UI.Clipboard.GetFormatsAsync();
CanPaste = formats.Contains(ProfileElementExtensions.ClipboardDataFormat);
// Can be null on some platforms
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
CanPaste = formats != null && formats.Contains(ProfileElementExtensions.ClipboardDataFormat);
}
private bool GetIsFocused(ProfileEditorFocusMode focusMode, RenderProfileElement? currentProfileElement)

View File

@ -174,8 +174,11 @@ public partial class TimelineKeyframeViewModel<T> : ActivatableViewModelBase, IT
private async void UpdateCanPaste(bool isFlyoutOpen)
{
string[] formats = await Shared.UI.Clipboard.GetFormatsAsync();
CanPaste = formats.Contains("Artemis.Keyframes");
string[]? formats = await Shared.UI.Clipboard.GetFormatsAsync();
// Can be null on some platforms
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
CanPaste = formats != null && formats.Contains("Artemis.Keyframes");
}
#endregion