Skip to content

Commit

Permalink
Update Lua callback check in file config
Browse files Browse the repository at this point in the history
Modified the HaveLuaCallback function in file.go to use the GetConfig function for validating the callback script. This new implementation provides an additional null check to avoid potential null-pointer exceptions, increasing the robustness of the function.

Signed-off-by: Christian Roessner <c@roessner.co>
  • Loading branch information
Christian Roessner committed Jul 9, 2024
1 parent 29bb038 commit d389d9b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/config/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,12 @@ func (f *File) HaveLuaActions() bool {

func (f *File) HaveLuaCallback() bool {
if f.HaveLua() {
return f.Lua.Config.CallbackScriptPath != ""
getConfig := f.GetConfig(global.BackendLua)
if getConfig == nil {
return false
}

return getConfig.(*LuaConf).CallbackScriptPath != ""
}

return false
Expand Down

0 comments on commit d389d9b

Please sign in to comment.