rjkroege/edwood

ReadRuneAt coding error

Closed this issue · 0 comments

Some kind of internal error in thew newtype Buffer implementation. By code inspection:
b.findPiece() is returning nil in ReadRuneAt(). Proposed fix: re-order the code to
do the nil check at the right place.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x1030f3a90]

goroutine 15 [running]:
github.com/rjkroege/edwood/file.(*piece).len(...)
	/Users/rjkroege/tools/edwood/file/buffer.go:760
github.com/rjkroege/edwood/file.(*Buffer).ReadRuneAt(0x140001c5050, {0x112c8, 0x110dc})
	/Users/rjkroege/tools/edwood/file/buffer.go:819 +0x40
github.com/rjkroege/edwood/file.(*Buffer).ReadC(0x140001c5050, 0x110dc)
	/Users/rjkroege/tools/edwood/file/buffer_adapter.go:39 +0x4c
github.com/rjkroege/edwood/file.(*ObservableEditableBuffer).ReadC(...)
	/Users/rjkroege/tools/edwood/file/observable_editable_buffer.go:236
main.(*Text).Show(0x14001314d20, 0x110dd, 0x110dd, 0x0)
	/Users/rjkroege/tools/edwood/text.go:1238 +0x1fc
main.xfidwrite(0x140005e42c0)
	/Users/rjkroege/tools/edwood/xfid.go:518 +0x994
main.xfidctl(0x140005e42c0, {0x1031d87d8, 0x14000120008})
	/Users/rjkroege/tools/edwood/xfid.go:40 +0x8c
created by main.xfidallocthread
	/Users/rjkroege/tools/edwood/acme.go:534 +0x16c