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 20:10:02 +00:00
co-authored by Claude
parent d789fa3e85
commit 6fa024a8af
+6 -2
View File
@@ -658,8 +658,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