JSStackTrace -> Ensure lineNumber exists before consuming (#24399)
Summary: Fixes https://github.com/facebook/react-native/issues/24382 [ANDROID] [INTERNAL] - Fixed a `NoSuchKeyException` when parsing JS stack frames without line numbers. Pull Request resolved: https://github.com/facebook/react-native/pull/24399 Differential Revision: D14890746 Pulled By: cpojer fbshipit-source-id: cea3653076484ad624084c370439f8a39c303083
This commit is contained in:
parent
72b4cc091d
commit
d7bd6cce38
|
@ -24,8 +24,18 @@ public class JSStackTrace {
|
|||
stringBuilder
|
||||
.append(frame.getString("methodName"))
|
||||
.append("@")
|
||||
.append(parseFileId(frame))
|
||||
.append(parseFileId(frame));
|
||||
|
||||
if (frame.hasKey("lineNumber") &&
|
||||
!frame.isNull("lineNumber") &&
|
||||
frame.getType("lineNumber") == ReadableType.Number) {
|
||||
stringBuilder
|
||||
.append(frame.getInt("lineNumber"));
|
||||
} else {
|
||||
stringBuilder
|
||||
.append(-1);
|
||||
}
|
||||
|
||||
if (frame.hasKey("column") &&
|
||||
!frame.isNull("column") &&
|
||||
frame.getType("column") == ReadableType.Number) {
|
||||
|
@ -33,6 +43,7 @@ public class JSStackTrace {
|
|||
.append(":")
|
||||
.append(frame.getInt("column"));
|
||||
}
|
||||
|
||||
stringBuilder.append("\n");
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
|
|
Loading…
Reference in New Issue