Skip to content

Commit 39d2062

Browse files
xoobDonJayamanne
authored andcommitted
Fix undefined error when debugging modules (DonJayamanne#589)
Fixes an issue where launching a debug session with modules results in the error "Cannot read property 'cwd' of undefined"
1 parent 8cb9e94 commit 39d2062

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/client/debugger/Main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export class PythonDebugger extends DebugSession {
188188
}
189189
else {
190190
// When using modules ensure the cwd has been provided
191-
if (typeof args.cwd !== 'string' || args.cwd.length === 0 || this.launchArgs.cwd === 'null') {
191+
if (typeof args.cwd !== 'string' || args.cwd.length === 0 || (this.launchArgs && this.launchArgs.cwd === 'null')) {
192192
return this.sendErrorResponse(response, 2001, `'cwd' in 'launch.json' needs to point to the working directory`);
193193
}
194194
}
@@ -674,4 +674,4 @@ export class PythonDebugger extends DebugSession {
674674
}
675675
}
676676

677-
DebugSession.run(PythonDebugger);
677+
DebugSession.run(PythonDebugger);

0 commit comments

Comments
 (0)