mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Use base::SafeRound instead of std::round.
Previous assertion violations because of NaN from std::round were in video streaming, see commits27d58ba07b,8f5830d520. Now the crashes happened in the ConvertScale() call from a background thread when preparing an image from clipboard for sending to a chat.
This commit is contained in:
@@ -544,7 +544,9 @@ MTPVector<MTPJSONObjectValue> SessionPrivate::prepareInitParams() {
|
||||
sliced -= 24 * 3600;
|
||||
}
|
||||
const auto sign = (sliced < 0) ? -1 : 1;
|
||||
const auto rounded = std::round(std::abs(sliced) / 900.) * 900 * sign;
|
||||
const auto rounded = base::SafeRound(std::abs(sliced) / 900.)
|
||||
* 900
|
||||
* sign;
|
||||
return MTP_vector<MTPJSONObjectValue>(
|
||||
1,
|
||||
MTP_jsonObjectValue(
|
||||
|
||||
Reference in New Issue
Block a user