You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was parsing some demos in order to gather certain data from the player, but after 10 rounds, the parser crashed with invalid memory address or nil pointer dereference. I checked and I saw there was a leaver in the game.
My thought is that the player is parsed from the start, and when he leaves, he's not removed and still the parser tries to access data from him. Because he left, there is nothing to check, the player is nil, and the parser crashes
To Reproduce
Download the demo at this matchroom link, which contains the leaver player (the zipped demo file is here) and run the code below with the demo in place
Code:
package main
import (
"fmt""log""os"
dem "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
events "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events"
)
funcmain() {
f, err:=os.Open("/path/to/demo.dem")
iferr!=nil {
log.Panic("failed to open demo file: ", err)
}
deferf.Close()
p:=dem.NewParser(f)
deferp.Close()
// Register handler on kill eventsp.RegisterEventHandler(func(e events.Kill) {
fmt.Printf("%s <%v> %s\n", e.Killer, e.Weapon, e.Victim)
})
// Parse to enderr=p.ParseToEnd()
iferr!=nil {
log.Panic("failed to parse demo: ", err)
}
}
Expected behavior
I could expect the parser to ignore the missing player and not show him from the moment he's not on the server anymore. However, this is not the case and it crashes. I am not really able to troubleshoot the error myself, but I'd start at pkg/demoinfocs/datatables.go:116 which is where the error logs show something
Library version
The library is at version V4
Additional context
Running Windows 10 and Go 1.21.3
The text was updated successfully, but these errors were encountered:
I was parsing some demos in order to gather certain data from the player, but after 10 rounds, the parser crashed with invalid memory address or nil pointer dereference. I checked and I saw there was a leaver in the game.
My thought is that the player is parsed from the start, and when he leaves, he's not removed and still the parser tries to access data from him. Because he left, there is nothing to check, the player is nil, and the parser crashes
To Reproduce
Download the demo at this matchroom link, which contains the leaver player (the zipped demo file is here) and run the code below with the demo in place
Code:
Expected behavior
I could expect the parser to ignore the missing player and not show him from the moment he's not on the server anymore. However, this is not the case and it crashes. I am not really able to troubleshoot the error myself, but I'd start at
pkg/demoinfocs/datatables.go:116
which is where the error logs show somethingLibrary version
The library is at version V4
Additional context
Running Windows 10 and Go 1.21.3
The text was updated successfully, but these errors were encountered: