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

Navigator.pushAndRemoveUntil throws exception in Bugsnag #242

Merged
merged 9 commits into from
Apr 23, 2024

Conversation

robert-smartbear
Copy link
Contributor

Goal

Fixed an issue related to setting context by navigator observer. In some cases a null is received on Android as a JSONObject.

Changeset

Added safety checks

Testing

Manual testing

@robert-smartbear robert-smartbear changed the title Navigator.pushAndRemoveUntil throws exception in Bugsnag #238 Navigator.pushAndRemoveUntil throws exception in Bugsnag Apr 16, 2024
@@ -291,7 +291,7 @@ Void clearFeatureFlags(@Nullable JSONObject args) {
}

Void addMetadata(@Nullable JSONObject args) throws JSONException {
if (args == null || !args.has("section") || !args.has("metadata")) {
if (args == null || !hasString(args,"section") || args.has("metadata")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: formatting

Suggested change
if (args == null || !hasString(args,"section") || args.has("metadata")) {
if (args == null || !hasString(args, "section") || args.has("metadata")) {

@@ -317,7 +317,7 @@ Void clearMetadata(@Nullable JSONObject args) throws JSONException {
}

JSONObject getMetadata(@Nullable JSONObject args) throws JSONException {
if (args == null || !args.has("section")) {
if (args == null || !hasString(args,"section")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: formatting

Suggested change
if (args == null || !hasString(args,"section")) {
if (args == null || !hasString(args,"section")) {

Comment on lines 408 to 410
if (!args.has(key)) {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check is redundant, if args.get(key) returns null the instanceof String check will fail and we return null.

Copy link
Contributor

@lemnik lemnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@robert-smartbear robert-smartbear merged commit faa15d0 into next Apr 23, 2024
11 checks passed
@robert-smartbear robert-smartbear deleted the robert/plat-11925_context_exception branch April 23, 2024 18:01
@robert-smartbear robert-smartbear mentioned this pull request Apr 23, 2024
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.

2 participants