ayn2op / discordo

A lightweight, secure, and feature-rich Discord terminal client.
MIT License
2.19k stars 69 forks source link

Error after recent commit to fix launching with no token #200

Closed imsoenthused closed 2 years ago

imsoenthused commented 2 years ago

No longer failing silently, but:

[jamieb@HP-Elitebook-840-G1-EndeavourOS ~]$ discordo panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8b22b8]

goroutine 1 [running]: github.com/rivo/tview.(Application).Run.func1() /home/jamieb/go/pkg/mod/github.com/rivo/tview@v0.0.0-20220812085834-0e6b21a48e96/application.go:243 +0x4d panic({0x923a20, 0xe28c40}) /usr/lib/go/src/runtime/panic.go:884 +0x212 main.main.func1() /home/jamieb/.cache/yay/discordo-git/src/discordo/main.go:67 +0xf8 github.com/rivo/tview.(Button).InputHandler.func1(0xc0001a5c60?, 0x61bd3f?) /home/jamieb/go/pkg/mod/github.com/rivo/tview@v0.0.0-20220812085834-0e6b21a48e96/button.go:130 +0x42 github.com/rivo/tview.(Box).WrapInputHandler.func1(0xc0002f0a80?, 0xc0001e2ca8?) /home/jamieb/go/pkg/mod/github.com/rivo/tview@v0.0.0-20220812085834-0e6b21a48e96/box.go:167 +0x53 github.com/rivo/tview.(Form).InputHandler.func1(0x40f507?, 0x10?) /home/jamieb/go/pkg/mod/github.com/rivo/tview@v0.0.0-20220812085834-0e6b21a48e96/form.go:673 +0xb7 github.com/rivo/tview.(Box).WrapInputHandler.func1(0xc0002f2120?, 0xc0001a5d80?) /home/jamieb/go/pkg/mod/github.com/rivo/tview@v0.0.0-20220812085834-0e6b21a48e96/box.go:167 +0x53 github.com/rivo/tview.(Application).Run(0xc0002ae000) /home/jamieb/go/pkg/mod/github.com/rivo/tview@v0.0.0-20220812085834-0e6b21a48e96/application.go:335 +0x77d main.main() /home/jamieb/.cache/yay/discordo-git/src/discordo/main.go:147 +0x6bc [jamieb@HP-Elitebook-840-G1-EndeavourOS ~]$

ghost commented 2 years ago

Since the state (*state.State) is initialized when (*ui.Core).Run is called, the state is nil because the login form widget uses the state to log in with email and password as well to log in using 2FA code when the login button is clicked, so the login logic has to be separated from using the state; fortunately, Arikawa is extremely flexible, so this should be very simple to fix. I will open a pull request as soon as I get back. Thanks for the bug report!