diff --git a/externalhandler.go b/externalhandler.go index 548346d..c7e8dd5 100644 --- a/externalhandler.go +++ b/externalhandler.go @@ -30,13 +30,11 @@ func newExternalHandler() *ExternalHandler { // traverse ./handler directory, find all .lua files and load them directory := exePath + "/handlers" files, err := os.ReadDir(directory) - if err != nil { - log.Fatal(err) - } - - for _, file := range files { - if filepath.Ext(file.Name()) == ".lua" { - h.l.DoFile(filepath.Join(directory, file.Name())) + if err == nil { + for _, file := range files { + if filepath.Ext(file.Name()) == ".lua" { + h.l.DoFile(filepath.Join(directory, file.Name())) + } } }