修复 ImageViewer.Source 设置为null会报错的问题

修复 https://github.com/irihitech/Ursa.Avalonia/issues/680
This commit is contained in:
杨劼
2025-09-16 18:02:37 +08:00
parent 7f118d7b1c
commit be08931b47
3 changed files with 29 additions and 2 deletions

View File

@@ -149,6 +149,10 @@ public class ImageViewer: TemplatedControl
{
if(!IsLoaded) return;
IImage image = args.GetNewValue<IImage>();
if(image is null)
{
return;
}
Size size = image.Size;
double width = this.Bounds.Width;
double height = this.Bounds.Height;