Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AsyncImageLoader.Avalonia/AdvancedImage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private async void UpdateImage(string? source, IAsyncImageLoader? loader) {

var bitmap = await Task.Run(async () => {
try {
if (source == null)
if (string.IsNullOrWhiteSpace(source))
return null;

// A small delay allows to cancel early if the image goes out of screen too fast (eg. scrolling)
Expand Down
4 changes: 2 additions & 2 deletions AsyncImageLoader.Avalonia/ImageBrushLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ private static async void OnSourceChanged(ImageBrush imageBrush, AvaloniaPropert

Bitmap? bitmap = null;
try {
if (newValue is not null) {
bitmap = await AsyncImageLoader.ProvideImageAsync(newValue);
if (!string.IsNullOrWhiteSpace(newValue)) {
bitmap = await AsyncImageLoader.ProvideImageAsync(newValue!);
}
}
catch (Exception e) {
Expand Down
2 changes: 1 addition & 1 deletion AsyncImageLoader.Avalonia/ImageLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static async void OnSourceChanged(Image sender, AvaloniaPropertyChangedE
return new CancellationTokenSource();
});

if (url == null) {
if (string.IsNullOrWhiteSpace(url)) {
((ICollection<KeyValuePair<Image, CancellationTokenSource>>)PendingOperations).Remove(
new KeyValuePair<Image, CancellationTokenSource>(sender, cts));
sender.Source = null;
Expand Down