Fixed inability to create a wallet without an image

This commit is contained in:
TheXamlGuy
2024-07-02 11:58:07 +01:00
parent 840d8fb679
commit de1cd3db55
5 changed files with 18 additions and 14 deletions
+5 -5
View File
@@ -11,17 +11,17 @@ public class CreateWalletHandler(IWalletHostFactory componentFactory,
public async Task<bool> Handle(CreateEventArgs<Wallet<(string, string, IImageDescriptor?)>> args,
CancellationToken cancellationToken)
{
if (args.Sender is Wallet <(string, string, IImageDescriptor?)> Wallet)
if (args.Sender is Wallet<(string, string, IImageDescriptor?)> wallet)
{
if (Wallet.Value is (string name, string password,
IImageDescriptor thumbnail) &&
name is { Length: > 0 } &&
(string name, string password, IImageDescriptor? imageDescriptor) = wallet.Value;
if (name is { Length: > 0 } &&
password is { Length: > 0 })
{
if (componentFactory.Create(name) is IComponentHost host)
{
IWalletFactory factory = host.Services.GetRequiredService<IWalletFactory>();
if (await factory.Create(name, password, thumbnail))
if (await factory.Create(name, password, imageDescriptor))
{
host.Start();
publisher.Publish(Activated.As(new Wallet<IComponentHost>(host)));