Skip to content

Commit

Permalink
Secondary source try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Sep 7, 2024
1 parent e9a4c44 commit 78d877a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/PicView.Avalonia/CustomControls/PicBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using PicView.Avalonia.UI;
using PicView.Avalonia.ViewModels;
using PicView.Core.Config;
using PicView.Core.Navigation;
using Vector = Avalonia.Vector;


Expand Down Expand Up @@ -224,6 +225,10 @@ private void RenderBasedOnSettings(DrawingContext context, IImage source)
sourceSize = source.Size;
if (isSideBySide)
{
if (secondarySource is null)
{
return;
}
secondarySourceSize = secondarySource.Size;
}
}
Expand Down Expand Up @@ -264,7 +269,6 @@ private void RenderBasedOnSettings(DrawingContext context, IImage source)
#endif
return;
}

}
else return;
}
Expand All @@ -277,7 +281,14 @@ private void RenderBasedOnSettings(DrawingContext context, IImage source)
}
else
{
return;
if (vm.ImageIterator is not null)
{
var nextIndex = vm.ImageIterator.GetIteration(vm.ImageIterator.CurrentIndex, vm.ImageIterator.IsReversed ? NavigateTo.Previous : NavigateTo.Next);
var magickImage = new MagickImage();
magickImage.Ping(vm.ImageIterator.ImagePaths[nextIndex]);
secondarySourceSize = new Size(magickImage.Width, magickImage.Height);
}
else return;
}
}
}
Expand Down

0 comments on commit 78d877a

Please sign in to comment.