Skip to content

Commit

Permalink
Fix not thread safe #180
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Jan 21, 2024
1 parent c957154 commit 87f1e1e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions season.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func (c Carbon) Season() string {
case month == 12 || month == 1 || month == 2:
index = 3
}
c.lang.rw.Lock()
defer c.lang.rw.Unlock()
if seasons, ok := c.lang.resources["seasons"]; ok {
slice := strings.Split(seasons, "|")
if len(slice) == QuartersPerYear {
Expand Down

0 comments on commit 87f1e1e

Please sign in to comment.