Clamp percentage value.
This commit is contained in:
parent
518f11f40a
commit
0e56b7e527
@ -3855,7 +3855,7 @@ double ContactsManager::get_percentage_value(double part, double total) {
|
|||||||
if (part > 1e20) {
|
if (part > 1e20) {
|
||||||
return 100.0;
|
return 100.0;
|
||||||
}
|
}
|
||||||
return part / total * 100;
|
return clamp(0.0, part / total * 100, 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<td_api::statisticalValue> ContactsManager::convert_stats_absolute_value(
|
tl_object_ptr<td_api::statisticalValue> ContactsManager::convert_stats_absolute_value(
|
||||||
|
Loading…
Reference in New Issue
Block a user