forked from tslocum/cview
Panic when attempting to add an invalid FormItem
This commit is contained in:
parent
db81e43e00
commit
3d1844e33b
|
@ -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
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…
Reference in New Issue