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

[media-library] Fix getAssetsAsync crash when given invalid after value on Android #9466

Merged
merged 3 commits into from Jul 29, 2020

Conversation

barthap
Copy link
Contributor

@barthap barthap commented Jul 29, 2020

Why

Fixes #9440

Non-number string values caused Integer.parseInt() throwing uncaught NumberFormatException in background thread - this crashed the whole application.

How

Surrounded parseInt() within a try-catch block with fallback to default value.

Test Plan

Tested getAssetsAsync({after: ... }) for different string values (both valid and invalid) on Android emulator.

@barthap barthap requested a review from lukmccall July 29, 2020 05:41
@github-actions
Copy link
Contributor

Native Component List for this branch is ready

@barthap barthap marked this pull request as ready for review July 29, 2020 06:57
@barthap barthap requested a review from tsapeta as a code owner July 29, 2020 06:57
@lukmccall lukmccall merged commit 9bca879 into master Jul 29, 2020
@lukmccall lukmccall deleted the @barthap/media-library/fix-assets-after branch July 29, 2020 08:03
barthap added a commit that referenced this pull request Jul 31, 2020
commit d56ff1c
Author: Tomasz Sapeta <1714764+tsapeta@users.noreply.github.com>
Date:   Wed Jul 29 11:49:15 2020 +0200

    [et] Move UpdateVersions from xdl to expotools (#9336)

    # Why

    Part of expo/expo-cli#2282

    # How

    Moved some functionality of xdl's UpdateVersions to expotools and refactored `et client-build` command a little bit.

    # Test Plan

    Tested with `et client-build -p ios --release --skip-upload`, will test Android soon

commit b5532de
Author: Michał Czernek <czernekmichal@gmail.com>
Date:   Wed Jul 29 11:13:45 2020 +0200

    [expo-module-template] Add unit tests in android module template.

commit fc7bc75
Author: Tomasz Sapeta <tsapeta@users.noreply.github.com>
Date:   Wed Jul 29 10:17:35 2020 +0200

    [bare-expo] Install pods

commit 9bca879
Author: Bartłomiej Klocek <bartlomiej.klocek@swmansion.com>
Date:   Wed Jul 29 10:03:05 2020 +0200

    [media-library] Fix `getAssetsAsync` crash when given invalid `after` value on Android (#9466)

    # Why

    Fixes #9440

    Non-number string values caused `Integer.parseInt()` throwing uncaught `NumberFormatException` in background thread - this crashed the whole application.

    # How

    Surrounded `parseInt()` within a `try-catch` block with fallback to default value.

    # Test Plan

    Tested `getAssetsAsync({after: ... })` for different string values (both valid and invalid) on Android emulator.
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.

MediaLibrary.getAssetsAsync() crashes and closes app in expo on android
3 participants