Skip to content

Commit

Permalink
avoid copying nil modifiers slice
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Mar 22, 2022
1 parent 7d146ea commit bdead81
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lang/semantic_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ type SemanticTokenModifier string
type SemanticTokenModifiers []SemanticTokenModifier

func (stm SemanticTokenModifiers) Copy() SemanticTokenModifiers {
if stm == nil {
return nil
}

modifiersCopy := make(SemanticTokenModifiers, len(stm))
copy(modifiersCopy, stm)
return modifiersCopy
Expand Down

0 comments on commit bdead81

Please sign in to comment.