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

Terminal widget crashes: invalid memory address or nil pointer dereference #41

Closed
Peter2121 opened this issue Feb 14, 2022 · 1 comment

Comments

@Peter2121
Copy link

According to the document https://github.com/gcla/gowid/blob/master/docs/Widgets.md :
The terminal canvas implements io.Writer allowing a client to write ANSI codes using this standard Golang interface.

I'm trying to send something to a terminal widgets, adding the following code after

		_, err = t.Canvas().Write([]byte("ls -lisa \n"))
		if err != nil {
    		panic(err)
		}				

The application crashes as follows:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x553546]

goroutine 1 [running]:
github.com/gcla/gowid/widgets/terminal.(*Canvas).ProcessByte(0x0, 0x6c)
	/home/peter/Programming/golang/gowid/widgets/terminal/term_canvas.go:1485 +0x26
github.com/gcla/gowid/widgets/terminal.(*Canvas).Write(0x0, {0xc0001d7b06, 0xa, 0xa})
	/home/peter/Programming/golang/gowid/widgets/terminal/term_canvas.go:427 +0x45
main.main()
	/home/peter/Programming/golang/gowid/examples/gowid-terminal/terminal.go:289 +0x1c98
exit status 2
@Peter2121
Copy link
Author

OK, I see, the canvas is not created yet here.

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

No branches or pull requests

1 participant