Skip to content

Commit

Permalink
player/player.go: add empty string check in command resolution.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dasciam authored Jan 8, 2025
1 parent 16b0d3e commit 26ca0c5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions server/player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,17 @@ func (p *Player) ExecuteCommand(commandLine string) {
return
}
args := strings.Split(commandLine, " ")
command, ok := cmd.ByAlias(args[0][1:])

name := args[0]
if name == "" {
return
}
name = name[1:]

command, ok := cmd.ByAlias(name)
if !ok {
o := &cmd.Output{}
o.Errort(cmd.MessageUnknown, args[0])
o.Errort(cmd.MessageUnknown, name)
p.SendCommandOutput(o)
return
}
Expand Down

0 comments on commit 26ca0c5

Please sign in to comment.