Skip to content

Commit

Permalink
Add a safeguard against incorrect Java method argument type assumption
Browse files Browse the repository at this point in the history
Summary: Adds a safeguard inside Java side marshalling of the arguments via ReadableArray - even though the majority of code do make an explicit assumption of the argument type, in practice it's not always the case.

Differential Revision: D60700917
  • Loading branch information
rshest authored and facebook-github-bot committed Aug 2, 2024
1 parent 8d4fd07 commit b34960e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public Integer extractArgument(
@Override
public String extractArgument(
JSInstance jsInstance, ReadableArray jsArguments, int atIndex) {
if (jsArguments.isNull(atIndex) || jsArguments.getType(atIndex) != ReadableType.String) {
return null;
}
return jsArguments.getString(atIndex);
}
};
Expand Down

0 comments on commit b34960e

Please sign in to comment.