Skip to content

Commit

Permalink
fix(ansi): param should return -1 if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Nov 4, 2024
1 parent 354bfee commit 12fe954
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ansi/parser_decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,11 @@ type Param int
// Param returns the parameter at the given index.
// It returns -1 if the parameter does not exist.
func (s Param) Param() int {
return int(s) & parser.ParamMask
p := int(s) & parser.ParamMask
if p == parser.MissingParam {
return -1
}
return p
}

// HasMore returns true if the parameter has more sub-parameters.
Expand Down

0 comments on commit 12fe954

Please sign in to comment.