golive icon indicating copy to clipboard operation
golive copied to clipboard

panic upon closing todo window

Open ijt opened this issue 2 years ago • 0 comments

Steps taken:

  1. cd examples/todo
  2. go build
  3. ./todo
  4. Open http://127.0.0.1:3000 in a browser window
  5. Close the window.

Expected: The server keeps running.

Actual: The server crashes like this:

GL 21:20:52 WRN handle ws request: unexpected connection close
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x13eabf1]

goroutine 52 [running]:
github.com/fasthttp/websocket.(*Conn).Close(...)
        /Users/issactrotts/pkg/mod/github.com/fasthttp/[email protected]/conn.go:344
github.com/brendonmatos/golive.(*LiveServer).HandleWSRequest.func2()
        /Users/issactrotts/src/github.com/brendonmatos/golive/server.go:196 +0x471
created by github.com/brendonmatos/golive.(*LiveServer).HandleWSRequest
        /Users/issactrotts/src/github.com/brendonmatos/golive/server.go:182 +0x305

ijt avatar Sep 29 '21 03:09 ijt