diff options
| author | Jeff Carr <[email protected]> | 2024-02-09 09:48:40 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-09 09:48:40 -0600 |
| commit | 12829e6e1c193bf7e98d9b13129d16c862995491 (patch) | |
| tree | 370075c91f99ea83d133968f7169ceaefab8f03f | |
| parent | 0f9b7ec2afdac1b5bbe4605851a3fdb1bb4b66b5 (diff) | |
nil check in wrong place
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | init.go | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -14,11 +14,6 @@ var muAction sync.Mutex // TODO: add checks for nil function pointers func (me *TreeInfo) newAction(a widget.Action) { n := me.treeRoot.FindWidgetId(a.WidgetId) - if n == nil { - log.Log(TREEWARN, "tree.FindWidgetId() n == nil", a.WidgetId, a.WidgetType, a.ActionType) - log.Log(TREEWARN, "tree.FindWidgetId() n == nil", a.State.CurrentS) - log.Log(TREEWARN, "tree.FindWidgetId() n == nil. This should not happen. Bug in gui or tree package?") - } switch a.ActionType { case widget.Add: if n == nil { @@ -26,6 +21,16 @@ func (me *TreeInfo) newAction(a widget.Action) { me.Add(n) return } + log.Log(TREEWARN, "attempting to re-add widget", a.WidgetId, a.WidgetType, a.ActionType) + return + } + if n == nil { + log.Log(TREEWARN, "tree.FindWidgetId() n == nil", a.WidgetId, a.WidgetType, a.ActionType) + log.Log(TREEWARN, "tree.FindWidgetId() n == nil", a.State.CurrentS) + log.Log(TREEWARN, "tree.FindWidgetId() n == nil. This should not happen. Bug in gui or tree package?") + // return + } + switch a.ActionType { case widget.SetText: log.Log(TREE, "tree.SetText() a.State.CurrentS =", a.State.CurrentS) log.Log(TREE, "tree.SetText() a.State.DefaultS =", a.State.DefaultS) |
