Add nil checks for Action and Bind in translate function to prevent potential nil pointer dereferences
This commit is contained in:
parent
13a343a7f4
commit
7efce91092
1 changed files with 3 additions and 3 deletions
|
|
@ -106,16 +106,16 @@ func (dsl *DSL) translate(name string, process *gouProcess.Process, data interfa
|
|||
}
|
||||
|
||||
widgets := []string{}
|
||||
if dsl.Action.Bind.Model != "" {
|
||||
if dsl.Action != nil && dsl.Action.Bind != nil && dsl.Action.Bind.Model != "" {
|
||||
m := model.Select(dsl.Action.Bind.Model)
|
||||
widgets = append(widgets, fmt.Sprintf("model.%s", m.ID))
|
||||
}
|
||||
|
||||
if dsl.Action.Bind.Table != "" {
|
||||
if dsl.Action != nil && dsl.Action.Bind != nil && dsl.Action.Bind.Table != "" {
|
||||
widgets = append(widgets, fmt.Sprintf("table.%s", dsl.Action.Bind.Table))
|
||||
}
|
||||
|
||||
if dsl.Action.Bind.Form != "" {
|
||||
if dsl.Action != nil && dsl.Action.Bind != nil && dsl.Action.Bind.Form != "" {
|
||||
widgets = append(widgets, fmt.Sprintf("form.%s", dsl.Action.Bind.Form))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue