Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow UriImageSource.Uri to be null #90

Open
Dreamescaper opened this issue May 25, 2021 · 3 comments
Open

Allow UriImageSource.Uri to be null #90

Dreamescaper opened this issue May 25, 2021 · 3 comments
Labels
need-info I need more info?

Comments

@Dreamescaper
Copy link

Native Xamarin.Forms allows UriImageSource.Uri to be null - it behaves same as when ImageSource is null. With Glidex.Forms, however, it fails in GlideExtensions.LoadViaGlide method.

@jonathanpeppers
Copy link
Owner

Can you share an example code snippet that fails?

Maybe you could add a page to this app? https://github.com/jonathanpeppers/glidex/tree/master/glidex.forms.sample/Forms

Thanks!

@jonathanpeppers jonathanpeppers added the need-info I need more info? label Oct 15, 2021
@visualbruno
Copy link

Native Xamarin.Forms allows UriImageSource.Uri to be null - it behaves same as when ImageSource is null. With Glidex.Forms, however, it fails in GlideExtensions.LoadViaGlide method.

Hi Dreamescaper.
I just replaced the code in GlideExtensions.cs file:

				case UriImageSource uriSource:
					{
						if(uriSource is null || uriSource.Uri is null || string.IsNullOrEmpty(uriSource.Uri.OriginalString))
						{
							Clear (request, imageView);
							return;
						}

						builder = HandleUriImageSource (request, uriSource);
					}						
					break;

No more Null Reference Exception.
Regards

@jonathanpeppers
Copy link
Owner

@visualbruno if you fixed something, would you consider sending a pull request explaining the fix? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-info I need more info?
Projects
None yet
Development

No branches or pull requests

3 participants