Fix unwrap panic on trying to access rate limits (#178)

This commit is contained in:
Flori 2023-08-07 14:56:32 +02:00 committed by GitHub
commit b6ab9d47ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -237,6 +237,9 @@ impl ChorusRequest {
/// reset to the rate limit limit. /// reset to the rate limit limit.
/// 2. The remaining rate limit is decreased by 1. /// 2. The remaining rate limit is decreased by 1.
fn update_rate_limits(user: &mut UserMeta, limit_type: &LimitType, response_was_err: bool) { fn update_rate_limits(user: &mut UserMeta, limit_type: &LimitType, response_was_err: bool) {
if user.belongs_to.borrow().limits_information.is_none() {
return;
}
let instance_dictated_limits = [ let instance_dictated_limits = [
&LimitType::AuthLogin, &LimitType::AuthLogin,
&LimitType::AuthRegister, &LimitType::AuthRegister,