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

Do not crash when feed entries have no/invalid links #77

Merged
merged 2 commits into from
Sep 10, 2021
Merged

Do not crash when feed entries have no/invalid links #77

merged 2 commits into from
Sep 10, 2021

Conversation

mormegil-cz
Copy link
Contributor

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.

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.
@bubelov
Copy link
Owner

bubelov commented Sep 10, 2021

Looks good, thanks!

@bubelov bubelov merged commit cf6fdea into bubelov:master Sep 10, 2021
@mormegil-cz mormegil-cz deleted the bugfix/empty-link-crash branch September 10, 2021 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants