Browse Source

Panic when attempting to add an invalid FormItem

tablepad
Trevor Slocum 2 years ago
parent
commit
3d1844e33b
  1. 1
      CHANGELOG
  2. 5
      form.go

1
CHANGELOG

@ -9,6 +9,7 @@ v1.5.0 (WIP)
- Revamp FormItem styling as FormItem.SetAttributes
- Provide DropDownOption in DropDown handlers
- Provide ListItem in List handlers
- Panic when attempting to add an invalid FormItem
v1.4.9 (2020-09-08)
- Add InputField.GetCursorPosition and InputField.SetCursorPosition

5
form.go

@ -1,6 +1,7 @@
package cview
import (
"reflect"
"sync"
"github.com/gdamore/tcell/v2"
@ -454,6 +455,10 @@ func (f *Form) AddFormItem(item FormItem) *Form {
f.Lock()
defer f.Unlock()
if reflect.ValueOf(item).IsNil() {
panic("Invalid FormItem")
}
f.items = append(f.items, item)
return f
}

Loading…
Cancel
Save