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

Index out of range error on QueryRules #11

Open
wrefgtzweve opened this issue Jun 30, 2023 · 1 comment
Open

Index out of range error on QueryRules #11

wrefgtzweve opened this issue Jun 30, 2023 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@wrefgtzweve
Copy link

Might be related to #8

Getting this error when i try to query rules on some Gmod servers:

panic: runtime error: index out of range [3] with length 1

goroutine 699 [running]:
encoding/binary.littleEndian.Uint32(...)
        C:/Program Files/Go/src/encoding/binary/binary.go:64
github.com/rumblefrog/go-a2s.(*PacketReader).ReadUint32(...)
        C:/Users/XXXX/go/pkg/mod/github.com/rumblefrog/go-a2s@v1.0.1/packet.go:89
github.com/rumblefrog/go-a2s.(*Client).getChallenge(0x17d2a90c328?, {0xc000425a30?, 0xc000b75c98?, 0xc0013f6930?}, 0x45)
        C:/Users/XXXX/go/pkg/mod/github.com/rumblefrog/go-a2s@v1.0.1/challenge.go:28 +0x1d5
github.com/rumblefrog/go-a2s.(*Client).QueryRules(0xc0003dec60?)
        C:/Users/XXXX/go/pkg/mod/github.com/rumblefrog/go-a2s@v1.0.1/rules.go:47 +0x54
main.fetchServer({{0xc0003dec60, 0x15}, 0x698c, {0xc0003dec78, 0x11}, {0xc0003dc540, 0x3d}, 0xfa0, {0xc0003dbe80, 0x9}, ...})
        C:/project/main.go:55 +0x8f
main.main.func1()
        C:/project/main.go:102 +0xd8
created by main.main
        C:/project/main.go:91 +0x3a5
exit status 2

Code:

	client, err := a2s.NewClient(server.Addr)
	if err != nil {
		return
	}

	defer client.Close()
	rules, err := client.QueryRules()
	if err != nil {
		return
	}
@rumblefrog rumblefrog added help wanted Extra attention is needed good first issue Good for newcomers labels Nov 27, 2024
@rumblefrog
Copy link
Owner

rumblefrog commented Nov 27, 2024

Sorry for very late response, potentially fixed by #10 which is in 1.0.2, if you could give that a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants