Do not crash when feed entries have no/invalid links#77
Merged
bubelov merged 2 commits intobubelov:masterfrom Sep 10, 2021
mormegil-cz:bugfix/empty-link-crash
Merged
Do not crash when feed entries have no/invalid links#77bubelov merged 2 commits intobubelov:masterfrom mormegil-cz:bugfix/empty-link-crash
bubelov merged 2 commits intobubelov:masterfrom
mormegil-cz:bugfix/empty-link-crash
Conversation
When a feed item does not contain a link, the app currently makes up a link value `"null"`. Use an empty string instead. (Alternatively, the link at the entry might be nullable as well, but I�m not changing the logic that much; `NextcloudNewsApiAdapter` uses the same logic, anyway.)
When a feed item has no link or has a link which no installed app can handle, the app currently hard-crashes with a fatal `android.content.ActivityNotFoundException: No Activity found to handle Intent` exception. Modified so that when a feed item has no link (which is a completely valid use case for a RSS feed), the link floating action button is not displayed at all, and when a link is opened, the `ActivityNotFoundException` is caught and handled with an error dialog instead of crashing. Also, unified this behavior across other ext-link opening features in the app by creating a common `Fragment.openLink` extension function.
Owner
|
Looks good, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a feed item has no link or has a link which no installed app can handle,
the app currently hard-crashes with a fatal
android.content.ActivityNotFoundException: No Activity found to handle Intentexception.
Modified so that when a feed item has no link (which is a completely valid
use case for a RSS feed), the link floating action button is not displayed
at all, and when a link is opened, the
ActivityNotFoundExceptionis caughtand handled with an error dialog instead of crashing.