fix(native, ios): fixed null responseIdentifier crash #808
+12
−4
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.
Description
Fix: [iOS] Prevent potential nil-key crashes in Native Ad module
This PR hardens the Native Module against potential crashes caused by inserting
nil
values into anNSMutableDictionary
.load:
Method:responseId
isnil
, we now reject the promise with an error instead of crashing the app when trying to set the value in_adHolders
. Now matches Android implementation.destroy:
Method:removeObjectForKey:
to prevent anNSInvalidArgumentException
.emitAdEvent:withData:
Method:responseId ?: [NSNull null]
to match the safe handling already used for responseId in the code.nonnull
parameter.Release Summary
Resolving crash
NSInvalidArgumentException: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]
Checklist
and followed the process outlined there for submitting PRs.
Android
iOS
e2e
tests added or updated in__tests__e2e__
jest
tests added or updated in__tests__
Think
react-native-google-mobile-ads
is great? Please consider supporting the project with any of the below:Invertase
on Twitter