fix(tsconnect/wasm): nil-check lb and ln in shutdown() before use
lb and ln are only initialised during run(); calling shutdown() before run() panics on nil. Guard both fields before dereferencing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #13.
This commit is contained in:
@@ -637,8 +637,12 @@ func (i *jsIPN) logout() {
|
|||||||
func (i *jsIPN) shutdown() js.Value {
|
func (i *jsIPN) shutdown() js.Value {
|
||||||
return makePromise(func() (any, error) {
|
return makePromise(func() (any, error) {
|
||||||
i.shutdownOnce.Do(func() {
|
i.shutdownOnce.Do(func() {
|
||||||
i.lb.Shutdown()
|
if i.lb != nil {
|
||||||
i.ln.Close()
|
i.lb.Shutdown()
|
||||||
|
}
|
||||||
|
if i.ln != nil {
|
||||||
|
i.ln.Close()
|
||||||
|
}
|
||||||
close(i.shutdownCh)
|
close(i.shutdownCh)
|
||||||
})
|
})
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user