Skip to content

Commit bbfbd34

Browse files
committed
Fix NullPointerException in Exception Replay
make ThrowableState always instantiate the list of snpashots and mark it final
1 parent 75fe2b3 commit bbfbd34

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/exception/ExceptionProbeManager.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ boolean hasExceptionStateTracked() {
182182

183183
public static class ThrowableState {
184184
private final String exceptionId;
185-
private List<Snapshot> snapshots;
185+
private final List<Snapshot> snapshots = new ArrayList<>();
186186
private boolean snapshotSent;
187187

188188
private ThrowableState(String exceptionId) {
@@ -198,13 +198,10 @@ public List<Snapshot> getSnapshots() {
198198
}
199199

200200
public boolean isSampling() {
201-
return snapshots != null && !snapshots.isEmpty();
201+
return !snapshots.isEmpty();
202202
}
203203

204204
public void addSnapshot(Snapshot snapshot) {
205-
if (snapshots == null) {
206-
snapshots = new ArrayList<>();
207-
}
208205
snapshots.add(snapshot);
209206
}
210207

0 commit comments

Comments
 (0)