Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid memory address or nil pointer dereference for some demos #447

Closed
statist32 opened this issue Oct 17, 2023 · 3 comments
Closed

invalid memory address or nil pointer dereference for some demos #447

statist32 opened this issue Oct 17, 2023 · 3 comments

Comments

@statist32
Copy link
Contributor

statist32 commented Oct 17, 2023

Describe the bug
If I run the following code with v4 beta3 I get an invalid memory address or nil pointer dereference error.
If I use beta2 the code works fine.
This only occures on some demos I tested.

To Reproduce
Wrong (edit): https://www.hltv.org/matches/2356051/mouz-vs-big-iem-dallas-2022-europe-closed-qualifier
Correct (edit): https://www.hltv.org/matches/2355469/copenhagen-flames-vs-skade-pinnacle-cup-iii
The second played match (nuke) is the problem.

Code:

package main

import (
	"fmt"
	"os"

	dem "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
	events "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events"
)

func main() {
	demoPathName := "copenhagen-flames-vs-skade-m2-nuke.dem"
	f, err := os.Open(demoPathName)
	defer f.Close()
	if err != nil {
		panic(err)
	}
	// Create new demoparser
	parser := dem.NewParser(f)
	defer parser.Close()

	if err != nil {
		panic(err)
	}
	fmt.Println(demoPathName)
	parser.RegisterEventHandler(func(e events.GenericGameEvent) {
		// gs := parser.GameState()
		fmt.Println(e.Name)
	})

	err = parser.ParseToEnd()
	if err != nil {
		panic(err)
	}
}

Expected behavior
There should be no pointer error and the events should be printed.

Library version
github.com/markus-wa/demoinfocs-golang/v4 v4.0.0-beta.3

Additional context
MacOS Sonoma 14.0
GoLang 1.21.3

@markus-wa
Copy link
Owner

Hi @statist32 - neither of the two crash for me on the latest version

The second played match (nuke) is the problem.

The maps are vertigo and ancient, there is no nuke - maybe you linked the wrong match?

@statist32
Copy link
Contributor Author

@markus-wa
Copy link
Owner

markus-wa commented Oct 18, 2023

Thanks - fix is out in v4.0.0-beta.5 - https://github.com/markus-wa/demoinfocs-golang/releases/tag/v4.0.0-beta.5

seems like an other_death event was pointing to a destroyed entity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants