Skip to content

Commit bf9e6e9

Browse files
authored
chore: init listener first avoid panic error (#548)
1 parent 1773b1a commit bf9e6e9

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

internal/core/local_runtime/instance.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ func newPluginInstance(
7171
errReader: errReader,
7272
l: &sync.Mutex{},
7373
appConfig: appConfig,
74-
75-
notifiers: []PluginInstanceNotifier{},
76-
notifierLock: &sync.Mutex{},
74+
listener: make(map[string]func([]byte)),
75+
notifiers: []PluginInstanceNotifier{},
76+
notifierLock: &sync.Mutex{},
7777
}
7878

7979
return instance
@@ -82,9 +82,6 @@ func newPluginInstance(
8282
func (s *PluginInstance) setupStdioEventListener(session_id string, listener func([]byte)) {
8383
s.l.Lock()
8484
defer s.l.Unlock()
85-
if s.listener == nil {
86-
s.listener = map[string]func([]byte){}
87-
}
8885

8986
s.listener[session_id] = listener
9087
}

0 commit comments

Comments
 (0)