Skip to content

Commit 6208426

Browse files
Fix NPE when searching the source for the exception stack trace (#310)
Signed-off-by: Jinbo Wang <[email protected]>
1 parent 14bb785 commit 6208426

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/AdapterUtils.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ public static boolean isWindows() {
6868
* @return the absolute file path
6969
*/
7070
public static String sourceLookup(String[] sourcePaths, String sourceName) {
71-
for (String path : sourcePaths) {
72-
Path fullpath = Paths.get(path, sourceName);
73-
if (Files.isRegularFile(fullpath)) {
74-
return fullpath.toString();
71+
if (sourcePaths != null) {
72+
for (String path : sourcePaths) {
73+
Path fullpath = Paths.get(path, sourceName);
74+
if (Files.isRegularFile(fullpath)) {
75+
return fullpath.toString();
76+
}
7577
}
7678
}
7779
return null;

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/LaunchWithoutDebuggingDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,6 @@ public CompletableFuture<Response> launchInTerminal(LaunchArguments launchArgume
137137

138138
@Override
139139
public void preLaunch(LaunchArguments launchArguments, IDebugAdapterContext context) {
140-
// TODO Auto-generated method stub
140+
context.setSourcePaths(launchArguments.sourcePaths);
141141
}
142142
}

0 commit comments

Comments
 (0)