Skip to content

Commit

Permalink
don't panic if handlers directory is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
missdeer committed Jan 16, 2024
1 parent 304ce56 commit beb5da7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions externalhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}
}
}

Expand Down

0 comments on commit beb5da7

Please sign in to comment.