-
Notifications
You must be signed in to change notification settings - Fork 130
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
Crash: Media URL null returned by the API #10554
Conversation
@@ -145,7 +146,7 @@ class MediaFilesRepository @Inject constructor( | |||
|
|||
event.completed -> { | |||
val media = event.media | |||
val channelResult = if (media != null && media.url.isNotBlank()) { | |||
val channelResult = if (media != null && media.url.isNotNullOrEmpty() && media.url.isNotBlank()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really minor np, so feel free to merge without applying. But maybe with the check media.url.isNotNullOrEmpty()
should suffice? I can't think of a scenario where the URL value would be white spaces only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I just wanted to keep the original logic intact. I'll change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the code.
Thanks for handling this @0nko. The changes look good. I wonder if we should add some tracking for the error case where the |
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Fixes #10264. The WCAndroid client works with the wrong assumption that the
MediaModel.url
cannot be null. This PR handles that case.To test:
There's nothing to test since it's difficult to reproduce the scenario.