paper-plane icon indicating copy to clipboard operation
paper-plane copied to clipboard

fix: Avoid usize overflow when inserting day dividers

Open marhkb opened this issue 2 years ago • 0 comments

If a chat does not contain any messages, then the application crashes when tag dividers are inserted into the history.

thread 'main' panicked at 'attempt to subtract with overflow', src/tdlib/chat_history.rs:180:56

This crash can be easily avoided by transforming the inequality x < y - 1 to x + 1 < y.

Fixes #358.

marhkb avatar Aug 07 '22 19:08 marhkb