Skip to content

Commit ae42f48

Browse files
fix(runtime): read no inspector flags from a nil Arguments array
Config.Arguments is optional, but enableInspector indexed it whenever ArgumentsCount was above one. Stop at a nil array, and at a null element the way a C argv reader does, so the count alone can no longer make debug startup dereference an invalid pointer.
1 parent d02c8e4 commit ae42f48

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

NativeScript/inspector/JsV8InspectorClient.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ bool ShouldRewriteSourceMapURLs() {
181181

182182
notify_post(NOTIFICATION("AppLaunching"));
183183

184-
for (int i = 1; i < argc; i++) {
184+
// A nil Arguments array carries no flags whatever ArgumentsCount says, and a
185+
// null element ends the list the way it does in a C argv.
186+
for (int i = 1; argv != nullptr && i < argc && argv[i] != nullptr; i++) {
185187
BOOL startListening = NO;
186188
BOOL shouldWaitForDebugger = NO;
187189

0 commit comments

Comments
 (0)