Skip to content

Commit 0b616b3

Browse files
committed
Fix lspFrame.source NPE on stackTrace request
Follow up to: - microsoft#614 - microsoft#609 With the change to set the line number to 0 the jdiLineNumber != lspFrame.line comparison can evaluate to true: dap> lspFrame Types$StackFrame@78 column: 1 id: 6 line: 0 name: "0x000000002f0bc000.invokeVirtual(Object,Object)" presentationHint: "subtle" source: null dap> jdiLineNumber -1 `source` being null caused an NPE
1 parent b62897e commit 0b616b3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
import com.google.gson.JsonObject;
3030
import com.microsoft.java.debug.core.AsyncJdwpUtils;
3131
import com.microsoft.java.debug.core.DebugSettings;
32+
import com.microsoft.java.debug.core.DebugSettings.Switch;
3233
import com.microsoft.java.debug.core.DebugUtility;
3334
import com.microsoft.java.debug.core.IBreakpoint;
34-
import com.microsoft.java.debug.core.DebugSettings.Switch;
3535
import com.microsoft.java.debug.core.adapter.AdapterUtils;
3636
import com.microsoft.java.debug.core.adapter.IDebugAdapterContext;
3737
import com.microsoft.java.debug.core.adapter.IDebugRequestHandler;
@@ -40,13 +40,13 @@
4040
import com.microsoft.java.debug.core.adapter.SourceType;
4141
import com.microsoft.java.debug.core.adapter.formatter.SimpleTypeFormatter;
4242
import com.microsoft.java.debug.core.adapter.variables.StackFrameReference;
43+
import com.microsoft.java.debug.core.protocol.Events.TelemetryEvent;
4344
import com.microsoft.java.debug.core.protocol.Messages.Response;
4445
import com.microsoft.java.debug.core.protocol.Requests.Arguments;
4546
import com.microsoft.java.debug.core.protocol.Requests.Command;
4647
import com.microsoft.java.debug.core.protocol.Requests.StackTraceArguments;
4748
import com.microsoft.java.debug.core.protocol.Responses;
4849
import com.microsoft.java.debug.core.protocol.Types;
49-
import com.microsoft.java.debug.core.protocol.Events.TelemetryEvent;
5050
import com.sun.jdi.AbsentInformationException;
5151
import com.sun.jdi.IncompatibleThreadStateException;
5252
import com.sun.jdi.LocalVariable;
@@ -114,7 +114,7 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
114114
result.add(lspFrame);
115115
frameReference.setSource(lspFrame.source);
116116
int jdiLineNumber = AdapterUtils.convertLineNumber(jdiFrame.lineNumber, context.isDebuggerLinesStartAt1(), context.isClientLinesStartAt1());
117-
if (jdiLineNumber != lspFrame.line) {
117+
if (jdiLineNumber != lspFrame.line && lspFrame.source != null) {
118118
decompiledClasses.add(lspFrame.source.path);
119119
}
120120
}

0 commit comments

Comments
 (0)