Skip to content

Commit

Permalink
fix crash on daily reward
Browse files Browse the repository at this point in the history
Daily reward function accessing a nullptr std::optional
  • Loading branch information
dudantas committed Jan 4, 2025
1 parent e5fb63c commit 95a30e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/creatures/combat/condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,10 @@ bool ConditionRegeneration::executeCondition(const std::shared_ptr<Creature> &cr
const auto &player = creature->getPlayer();
int32_t dailyStreak = 0;
if (player) {
dailyStreak = static_cast<int32_t>(player->kv()->scoped("daily-reward")->get("streak")->getNumber());
auto optStreak = player->kv()->scoped("daily-reward")->get("streak");
if (optStreak) {
dailyStreak = static_cast<int32_t>(optStreak->getNumber());
}
}
if (creature->getZoneType() != ZONE_PROTECTION || dailyStreak >= DAILY_REWARD_HP_REGENERATION) {
if (internalHealthTicks >= getHealthTicks(creature)) {
Expand Down

0 comments on commit 95a30e4

Please sign in to comment.