[Crash] Fix possible dereference of nullptr in Client::CalcHPRegen (#3316)

This commit is contained in:
Aeadoin 2023-04-23 14:27:43 -04:00 committed by GitHub
parent 2d3ddcb574
commit 39b5374e92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -288,7 +288,7 @@ int64 Client::CalcHPRegen(bool bCombat)
if (!bCombat && CanFastRegen() && (IsSitting() || CanMedOnHorse())) {
auto max_hp = GetMaxHP();
int fast_regen = 6 * (max_hp / zone->newzone_data.fast_regen_hp);
int64 fast_regen = 6 * (max_hp / (zone ? zone->newzone_data.fast_regen_hp : 180));
if (base < fast_regen) // weird, but what the client is doing
base = fast_regen;
}