Add second check for position values (iOS) #296
Merged
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.
This PR resolves #295
What was causing the issue?
In
www/plugins.FileOpener2.js
:When calling
showOpenWithDialog
without an optional callbackContext object, an empty object is set by default in the JS bridge:When the
exec
function is called, the missing position data is then referenced in the arguments array, resulting in anundefined
value:In
src/ios/FileOpener2.m
:The
undefined
data is interpreted as aNSNull
object and still placed in the array.On line 86, there is a check for array length, but not a check to see if the object is valid. This means
positionValues
on line 87, which should be a 2 item array, is aNSNull
object instead. When the expected array items are accessed on line 88, this causes aNSInvalidArgumentException
.How does this PR correct this issue?
This PR adds a second check to the if statement on line 86 to make sure the item at index 3 in not
NSNull
.