Skip to content

Commit 2af3005

Browse files
committed
Initialize the breakpoints map in the beginning
Signed-off-by: Remy Suen <remy.suen@docker.com>
1 parent 7c4dd41 commit 2af3005

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

dap/adapter.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,9 @@ func newBreakpointMap() *breakpointMap {
568568
func (b *breakpointMap) Set(fname string, sbps []dap.SourceBreakpoint) (breakpoints []dap.Breakpoint) {
569569
b.mu.Lock()
570570
defer b.mu.Unlock()
571+
// explicitly initialize breakpoints so that
572+
// we do not send a null back in the JSON if there are no breakpoints
573+
breakpoints = []dap.Breakpoint{}
571574

572575
prev := b.byPath[fname]
573576
for _, sbp := range sbps {
@@ -590,11 +593,6 @@ func (b *breakpointMap) Set(fname string, sbps []dap.SourceBreakpoint) (breakpoi
590593
breakpoints = append(breakpoints, bp)
591594
}
592595
b.byPath[fname] = breakpoints
593-
if breakpoints == nil {
594-
// explicitly initialize breakpoints so that
595-
// we do not send a null back in the JSON if there are no breakpoints
596-
breakpoints = []dap.Breakpoint{}
597-
}
598596
return breakpoints
599597
}
600598

0 commit comments

Comments
 (0)