mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-03-13 12:33:43 +03:00
Fix a potential out of bounds panic
This commit is contained in:
parent
cc480dd2f3
commit
1cdc2045c7
@ -197,6 +197,10 @@ func (m *Model) LineUp(n int) (lines []string) {
|
||||
// COMMANDS
|
||||
|
||||
func Sync(m Model) tea.Cmd {
|
||||
if len(m.lines) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
top := max(m.YOffset, 0)
|
||||
bottom := min(m.YOffset+m.Height, len(m.lines)-1)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user