diff options
| author | Austin Hellyer <[email protected]> | 2016-11-12 12:13:39 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-12 12:13:39 -0800 |
| commit | 9d086a5592f0ced7607e0ea58b09523bd501a722 (patch) | |
| tree | 47c38d126fd877308f035a086b704b18b8a3cdb1 /src | |
| parent | Add a check for message content length (diff) | |
| download | serenity-9d086a5592f0ced7607e0ea58b09523bd501a722.tar.xz serenity-9d086a5592f0ced7607e0ea58b09523bd501a722.zip | |
Don't overflow on message length check
Diffstat (limited to 'src')
| -rw-r--r-- | src/model/channel.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs index cd2c099..7b55d5c 100644 --- a/src/model/channel.rs +++ b/src/model/channel.rs @@ -494,11 +494,11 @@ impl Message { pub fn overflow_length(content: &str) -> Option<u64> { // Check if the content is over the maximum number of unicode code // points. - let count = content.chars().count() as u64; - let diff = count - constants::MESSAGE_CODE_LIMIT as u64; + let count = content.chars().count() as i64; + let diff = count - (constants::MESSAGE_CODE_LIMIT as i64); if diff > 0 { - Some(diff) + Some(diff as u64) } else { None } |