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 is contained in:
2026-07-28 17:40:39 +00:00
co-authored by Claude
parent e91dbcfbe5
commit 34700154a4
+6 -2
View File
@@ -657,8 +657,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