Explorar o código

Avoid division by zero

Tulir Asokan %!s(int64=3) %!d(string=hai) anos
pai
achega
3479e1ccfc
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  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
 			}