Skip to content

Commit

Permalink
fix: don't crash on missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
cfoust committed Oct 31, 2023
1 parent 4c95a90 commit dd1a58f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/mux/screen/replay/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ func (r *Replay) setIndex(index, indexByte int, updateTime bool) {
toByte = geom.Clamp(toByte, 0, len(data)-1)
}

if fromIndex == toIndex {
data = data[fromByte+1 : toByte+1]
} else if fromIndex == i {
data = data[fromByte+1:]
} else if toIndex == i {
data = data[:toByte+1]
if len(data) > 0 {
if fromIndex == toIndex {
data = data[fromByte+1 : toByte+1]
} else if fromIndex == i {
data = data[fromByte+1:]
} else if toIndex == i {
data = data[:toByte+1]
}
}

r.terminal.Write(data)
Expand Down

0 comments on commit dd1a58f

Please sign in to comment.