소스 검색

Avoid division by zero

Tulir Asokan 3 년 전
부모
커밋
3479e1ccfc
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      portal.go

+ 4 - 1
portal.go

@@ -1990,7 +1990,10 @@ func (portal *Portal) convertMediaMessageContent(intent *appservice.IntentAPI, m
 					max = waveform[i]
 				}
 			}
-			multiplier := 1024 / max
+			multiplier := 0
+			if max > 0 {
+				multiplier = 1024 / max
+			}
 			if multiplier > 32 {
 				multiplier = 32
 			}