Skip to content

Commit

Permalink
null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlm committed Nov 30, 2024
1 parent 9973ac9 commit 80ef015
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ public void Initialize()
.ToFunc(() =>
{
var assembly = Assembly.Load("Avalonia.Win32");
ArgumentNullException.ThrowIfNull(assembly, "Avalonia.Win32");
var type = assembly.GetType(assembly.GetName().Name + ".ClipboardImpl");
var clipboard = (IClipboard)Activator.CreateInstance(type)!;
ArgumentNullException.ThrowIfNull(type, "ClipboardImpl");
IClipboard clipboard = Activator.CreateInstance(type) as IClipboard;
ArgumentNullException.ThrowIfNull(clipboard, nameof(clipboard));
return clipboard;
});
}
Expand Down

0 comments on commit 80ef015

Please sign in to comment.