On opening a change stream cursor for any database, whenever the cursor is used to decode, it panics on runtime.
Generate the case using: this
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x779242]
goroutine 1 [running]:
github.com/mongodb/mongo-go-driver/mongo.(*changeStream).Decode(0xc000118000, 0x7bb880, 0xc000116028, 0xc0000cfe01, 0x42ad92)
$GOPATH/src/github.com/mongodb/mongo-go-driver/mongo/change_stream.go:454 +0x62
main.traverseCursor(0x979100, 0xc00001e0f0, 0x97a0c0, 0xc000118000)
.../main.go:27 +0x48
main.watchOnDB(0x979100, 0xc00001e0f0, 0xc000093400, 0x84e5bc, 0x6)
.../main.go:68 +0x1dc
main.main()
.../main.go:81 +0x119
Process finished with exit code 2
I have resolved the bug and created a PR on Github: #117