DaleFarnsworth / codeplug

Obsolete. Code for reading, modifying, and writing codeplug files for the MD-380 DMR radio - Obsolete. Further development will be tracked in github.com/DaleFarnsworth-DMR
https://www.farnsworth.org/dale/codeplug
49 stars 10 forks source link

Index error in channel list window #19

Closed nivex closed 6 years ago

nivex commented 6 years ago

Steps to reproduce:

Result:

panic: runtime error: index out of range

goroutine 1 [running, locked to thread]:
github.com/dalefarnsworth/codeplug/ui.(*RecordList).SelectedRecords(0xc42000c0c0, 0xc42000c0c0, 0xc, 0x3)
    /media/sf_GOPATH0/src/github.com/dalefarnsworth/codeplug/ui/recordList.go:111 +0x164
github.com/dalefarnsworth/codeplug/ui.selectedRecords(0xc420477600, 0xc4204f7614, 0xc, 0x0)
    /media/sf_GOPATH0/src/github.com/dalefarnsworth/codeplug/ui/ui.go:2149 +0x3e
github.com/dalefarnsworth/codeplug/ui.setMultipleRecords(0xc420512cc0, 0xc420406ad8, 0x3, 0x0)
    /media/sf_GOPATH0/src/github.com/dalefarnsworth/codeplug/ui/ui.go:1151 +0x60
github.com/dalefarnsworth/codeplug/ui.setFieldString(0xc420512cc0, 0xc420406ad8, 0x3, 0xc420406ad8, 0x3)
    /media/sf_GOPATH0/src/github.com/dalefarnsworth/codeplug/ui/ui.go:1026 +0x74
github.com/dalefarnsworth/codeplug/ui.newFieldLineEdit.func1()
    /media/sf_GOPATH0/src/github.com/dalefarnsworth/codeplug/ui/ui.go:1446 +0xbe
github.com/therecipe/qt/widgets.callbackQLineEdit_EditingFinished(0x2cd41a0)
    /home/user/work/src/github.com/therecipe/qt/widgets/widgets-minimal.go:12613 +0x70
github.com/therecipe/qt/widgets._cgoexpwrap_bf025265ed45_callbackQLineEdit_EditingFinished(0x2cd41a0)
    _cgo_gotypes.go:21236 +0x2b
github.com/therecipe/qt/widgets._Cfunc_QWidget_EventDefault(0x2cd41a0, 0x7ffe6dda9050, 0x0)
    _cgo_gotypes.go:17051 +0x4a
github.com/therecipe/qt/widgets.(*QWidget).EventDefault.func1(0x2cd41a0, 0x7ffe6dda9050, 0x7ffe6dda9050)
    /home/user/work/src/github.com/therecipe/qt/widgets/widgets-minimal.go:21890 +0x8f
github.com/therecipe/qt/widgets.(*QWidget).EventDefault(0xc4204759f0, 0xa7b780, 0xc4205cd3c0, 0x5)
    /home/user/work/src/github.com/therecipe/qt/widgets/widgets-minimal.go:21890 +0x74
github.com/therecipe/qt/widgets.callbackQWidget_Event(0x2cd41a0, 0x7ffe6dda9050, 0xc420475a68)
    /home/user/work/src/github.com/therecipe/qt/widgets/widgets-minimal.go:21857 +0xdd
github.com/therecipe/qt/widgets._cgoexpwrap_bf025265ed45_callbackQWidget_Event(0x2cd41a0, 0x7ffe6dda9050, 0x0)
    _cgo_gotypes.go:22823 +0x35
github.com/therecipe/qt/widgets._Cfunc_QWidget_EventDefault(0x2cd41a0, 0x7ffe6dda9c90, 0x0)
    _cgo_gotypes.go:17051 +0x4a
github.com/therecipe/qt/widgets.(*QWidget).EventDefault.func1(0x2cd41a0, 0x7ffe6dda9c90, 0x7ffe6dda9c90)
    /home/user/work/src/github.com/therecipe/qt/widgets/widgets-minimal.go:21890 +0x8f
github.com/therecipe/qt/widgets.(*QWidget).EventDefault(0xc420475c88, 0xa7b780, 0xc4205cd3a8, 0x5)
    /home/user/work/src/github.com/therecipe/qt/widgets/widgets-minimal.go:21890 +0x74
github.com/therecipe/qt/widgets.callbackQWidget_Event(0x2cd41a0, 0x7ffe6dda9c90, 0xc420475d00)
    /home/user/work/src/github.com/therecipe/qt/widgets/widgets-minimal.go:21857 +0xdd
github.com/therecipe/qt/widgets._cgoexpwrap_bf025265ed45_callbackQWidget_Event(0x2cd41a0, 0x7ffe6dda9c90, 0x7ffe6dda9ae0)
    _cgo_gotypes.go:22823 +0x35
github.com/therecipe/qt/widgets._Cfunc_QApplication_QApplication_Exec(0xc400000000)
    _cgo_gotypes.go:2786 +0x49
github.com/therecipe/qt/widgets.(*QApplication).Exec(0xc420114480, 0xc42009e2e0)
    /home/user/work/src/github.com/therecipe/qt/widgets/widgets-minimal.go:3343 +0x22
github.com/dalefarnsworth/codeplug/ui.(*App).Exec(0xc420114480)
    /media/sf_GOPATH0/src/github.com/dalefarnsworth/codeplug/ui/ui.go:76 +0x2d
main.main()
    /media/sf_GOPATH0/src/github.com/dalefarnsworth/codeplug/editcp/editcp.go:326 +0x37c

Expected result:

DaleFarnsworth commented 6 years ago

Thank you for the report. I have reproduced it. I added the empty entry at the end of the list as a workaround for those who reported that their UI didn't show the last entry. I'll either fix it or remove it.

DaleFarnsworth commented 6 years ago

Fixed in v0.16.11 by making the extra blank entry non-selectable. Thank you.