Skip to content

Commit

Permalink
trial
Browse files Browse the repository at this point in the history
  • Loading branch information
uriziv1 committed Aug 25, 2024
1 parent 50e288a commit 35abf50
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func safeIntToInt32(val int) int32 {
if val < math.MinInt32 || val > math.MaxInt32 {
panic("integer overflow")
}
if val == math.MaxInt32 {

// Check if the conversion might lead to overflow
if val == math.MaxInt && math.MaxInt32 < math.MaxInt {
return math.MaxInt32
}
if val == math.MinInt32 {
return math.MinInt32
}

return int32(val)
}

Expand Down

0 comments on commit 35abf50

Please sign in to comment.