Clamp percentage value.

This commit is contained in:
levlam 2023-09-19 21:15:10 +03:00
parent 518f11f40a
commit 0e56b7e527

View File

@ -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(