From 519ac7447b9eabfa9a1b34f6f6c842185e0d2914 Mon Sep 17 00:00:00 2001 From: Graham Clark Date: Mon, 29 Nov 2021 23:20:17 -0500 Subject: [PATCH] Fix sporadic crash on startup - seen on termux panic: runtime error: index out of range [7] with length 7 goroutine 1 [running]: github.com/gcla/termshark/v2/ui.makePacketListModel(0x60602f78 98, 0x400028a6a8, 0x6060300838, 0x4003de68f0, 0x40003b1fe0) /home/builder/.termux-build/termshark/src/ui/ui.go:2289 github.com/gcla/termshark/v2/ui.updatePacketListWithData (0x60602f7898, 0x400028a6a8, 0x6060300838, 0x4003de68f0) /home/builder/.termux-build/termshark/src/ui/ui.go:230 --- ui/ui.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/ui.go b/ui/ui.go index d1a3007..340888d 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -2290,7 +2290,7 @@ func makePacketListModel(psml psmlInfo, app gowid.IApp) *psmlmodel.Model { if len(expandingModel.Comparators) > 0 { for i, _ := range expandingModel.Comparators { - if i < len(widths) { + if i < len(widths) && i < len(cols) { if field, ok := shark.AllowedColumnFormats[cols[i].Field.Token]; ok { if field.Comparator != nil { expandingModel.Comparators[i] = field.Comparator