[GH-ISSUE #459] index out of range #329

Closed
opened 2026-03-04 01:04:03 +03:00 by kerem · 7 comments
Owner

Originally created by @4781121 on GitHub (Jun 10, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/459

panic: runtime error: index out of range [7] with length 0 [recovered]
panic: runtime error: index out of range [7] with length 0

goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1(0xc00010e2a0)
d:/base/data/go/src/github.com/rivo/tview/application.go:244 +0x82
panic(0xb4a480, 0xc000462dc0)
d:/base/path/go/src/runtime/panic.go:969 +0x166
github.com/rivo/tview.(*TextView).Draw(0xc00013a780, 0xca5f00, 0xc00031ce00)
d:/base/data/go/src/github.com/rivo/tview/textview.go:944 +0xd89
github.com/rivo/tview.(*Grid).Draw(0xc000124360, 0xca5f00, 0xc00031ce00)
d:/base/data/go/src/github.com/rivo/tview/grid.go:613 +0x1245
github.com/rivo/tview.(*Pages).Draw(0xc000126ea0, 0xca5f00, 0xc00031ce00)
d:/base/data/go/src/github.com/rivo/tview/pages.go:278 +0xa8
github.com/rivo/tview.(*Flex).Draw(0xc000126f00, 0xca5f00, 0xc00031ce00)
d:/base/data/go/src/github.com/rivo/tview/flex.go:179 +0x28b
github.com/rivo/tview.(*Application).draw(0xc00010e2a0, 0x0)
d:/base/data/go/src/github.com/rivo/tview/application.go:582 +0xda
github.com/rivo/tview.(*Application).Draw.func1()
d:/base/data/go/src/github.com/rivo/tview/application.go:535 +0x2a
github.com/rivo/tview.(*Application).Run(0xc00010e2a0, 0x0, 0x0)
d:/base/data/go/src/github.com/rivo/tview/application.go:371 +0x9a6

Originally created by @4781121 on GitHub (Jun 10, 2020). Original GitHub issue: https://github.com/rivo/tview/issues/459 panic: runtime error: index out of range [7] with length 0 [recovered] panic: runtime error: index out of range [7] with length 0 goroutine 1 [running]: github.com/rivo/tview.(*Application).Run.func1(0xc00010e2a0) d:/base/data/go/src/github.com/rivo/tview/application.go:244 +0x82 panic(0xb4a480, 0xc000462dc0) d:/base/path/go/src/runtime/panic.go:969 +0x166 github.com/rivo/tview.(*TextView).Draw(0xc00013a780, 0xca5f00, 0xc00031ce00) d:/base/data/go/src/github.com/rivo/tview/textview.go:944 +0xd89 github.com/rivo/tview.(*Grid).Draw(0xc000124360, 0xca5f00, 0xc00031ce00) d:/base/data/go/src/github.com/rivo/tview/grid.go:613 +0x1245 github.com/rivo/tview.(*Pages).Draw(0xc000126ea0, 0xca5f00, 0xc00031ce00) d:/base/data/go/src/github.com/rivo/tview/pages.go:278 +0xa8 github.com/rivo/tview.(*Flex).Draw(0xc000126f00, 0xca5f00, 0xc00031ce00) d:/base/data/go/src/github.com/rivo/tview/flex.go:179 +0x28b github.com/rivo/tview.(*Application).draw(0xc00010e2a0, 0x0) d:/base/data/go/src/github.com/rivo/tview/application.go:582 +0xda github.com/rivo/tview.(*Application).Draw.func1() d:/base/data/go/src/github.com/rivo/tview/application.go:535 +0x2a github.com/rivo/tview.(*Application).Run(0xc00010e2a0, 0x0, 0x0) d:/base/data/go/src/github.com/rivo/tview/application.go:371 +0x9a6
kerem closed this issue 2026-03-04 01:04:03 +03:00
Author
Owner

@rivo commented on GitHub (Jun 10, 2020):

Can you post some (brief) code that allows me to reproduce this error, please?

<!-- gh-comment-id:641876116 --> @rivo commented on GitHub (Jun 10, 2020): Can you post some (brief) code that allows me to reproduce this error, please?
Author
Owner

@4781121 commented on GitHub (Jun 10, 2020):

我不清楚是哪里代码出的问题, 而且这个错误也没指出是哪里出的问题, 而且并不是经常报这个错误, 偶尔会报一下

<!-- gh-comment-id:641893842 --> @4781121 commented on GitHub (Jun 10, 2020): 我不清楚是哪里代码出的问题, 而且这个错误也没指出是哪里出的问题, 而且并不是经常报这个错误, 偶尔会报一下
Author
Owner

@rivo commented on GitHub (Jun 10, 2020):

Sorry, but this is not helpful. Please post in English.

<!-- gh-comment-id:642049967 --> @rivo commented on GitHub (Jun 10, 2020): Sorry, but this is not helpful. Please post in English.
Author
Owner

@4781121 commented on GitHub (Jun 10, 2020):

i can't post code, the code to many and the error files not in my codes, if error file in my codes i can fix it, now i don't found error point

<!-- gh-comment-id:642087431 --> @4781121 commented on GitHub (Jun 10, 2020): i can't post code, the code to many and the error files not in my codes, if error file in my codes i can fix it, now i don't found error point
Author
Owner

@ghostsquad commented on GitHub (Jun 15, 2020):

@xing88 what's he's asking for (ideally) is some minimal amount of code to reproduce this issue.

Based on the stacktrace, the offending line is this:

https://github.com/rivo/tview/blob/master/textview.go#L944

But what was it trying to draw at the time? and what the user was doing is still valuable information to figure out how to reproduce the panic and create a regression test and fix.

<!-- gh-comment-id:643932238 --> @ghostsquad commented on GitHub (Jun 15, 2020): @xing88 what's he's asking for (ideally) is some minimal amount of code to reproduce this issue. Based on the stacktrace, the offending line is this: https://github.com/rivo/tview/blob/master/textview.go#L944 But what was it trying to draw at the time? and what the user was doing is still valuable information to figure out how to reproduce the panic and create a regression test and fix.
Author
Owner

@rivo commented on GitHub (Jun 15, 2020):

I'd suggest you take a look at https://github.com/rivo/tview/wiki/Concurrency. If primitives such as TextView are modified in a separate goroutine without proper thread handling, it can lead to issues such as this one.

But if you are certain that this is not what's happening in your program, then, like @ghostsquad wrote, I would need a small piece of code that reproduces this issue. From the offending line alone, I don't see how such a panic can occur.

<!-- gh-comment-id:644214258 --> @rivo commented on GitHub (Jun 15, 2020): I'd suggest you take a look at https://github.com/rivo/tview/wiki/Concurrency. If primitives such as `TextView` are modified in a separate goroutine without proper thread handling, it can lead to issues such as this one. But if you are certain that this is not what's happening in your program, then, like @ghostsquad wrote, I would need a small piece of code that reproduces this issue. From the offending line alone, I don't see how such a panic can occur.
Author
Owner

@4781121 commented on GitHub (Jun 16, 2020):

@ghostsquad @rivo thanks

<!-- gh-comment-id:644455404 --> @4781121 commented on GitHub (Jun 16, 2020): @ghostsquad @rivo thanks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#329
No description provided.