V
V
vadimuar2019-02-21 19:28:36
go
vadimuar, 2019-02-21 19:28:36

Why does GoLang panic: runtime error?

I found telegram CLI on the git for my needs. But when sending a message to the group, it knocks out an error (everything is ok in a personal with the user):

This one
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x1207506]
goroutine 1 [running]:
main.(*TelegramCLI).RunCommand(0xc0000b20a0, 0xc0000a0fa0, 0x1, 0xc0000a0fe0)
/Users/admin/Downloads/telegramgo-master/main.go:474 +0x286
main.(*TelegramCLI).Run(0xc0000b20a0, 0x12a0d90, 0xc00007a3c0)
/Users/admin/Downloads/telegramgo-master/main.go:213 +0x343
main.main()
/Users/admin/Downloads/telegramgo-master/main.go:539 +0x546
exit status 2

Tried to find the reason, but couldn't.
Link to the code itself: https://github.com/shelomentsevd/telegramgo

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
grinat, 2019-02-21
@grinat

Because it looks like null comes here https://github.com/shelomentsevd/telegramgo/blob/m... and this answer comes from a third-party library https://github.com/shelomentsevd/mtproto/blob/mast...
Do fmt.println(update) there and see what comes up there. If the message is sent, then you can simply comment out cli.parseUpdate(*update)
But in general there is a jamb, like this:

update, err := cli.mtproto.MessagesSendMessage(false, false, false, true, mtproto.TL_inputPeerChat{Chat_id: int32(id)}, 0, args[1], rand.Int63(), mtproto.TL_null{}, nil)
if err != nil {
  return err
}
cli.parseUpdate(*update)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question