Skip to content

Commit 23d8e28

Browse files
committed
Update codes for lints/security
1 parent 4888846 commit 23d8e28

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

maybe.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,10 @@ func (maybeSelf someDef[T]) ToInt8() (int8, error) {
410410
return 0, ErrConversionSizeOverflow
411411
case byte:
412412
val, err := maybeSelf.ToByte()
413-
return int8(val), err
413+
if val <= math.MaxInt8 {
414+
return int8(val), err
415+
}
416+
return 0, ErrConversionSizeOverflow
414417
case int:
415418
val, err := maybeSelf.ToInt()
416419
if val >= math.MinInt8 && val <= math.MaxInt8 {

0 commit comments

Comments
 (0)