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:
2026-06-14 21:54:55 +00:00
parent 4618ee1496
commit e7270026f7
+6 -2
View File
@@ -637,8 +637,12 @@ func (i *jsIPN) logout() {
func (i *jsIPN) shutdown() js.Value {
return makePromise(func() (any, error) {
i.shutdownOnce.Do(func() {
i.lb.Shutdown()
i.ln.Close()
if i.lb != nil {
i.lb.Shutdown()
}
if i.ln != nil {
i.ln.Close()
}
close(i.shutdownCh)
})
return nil, nil