SAGA2: Fix CID 1457983 which is false positive, but could prevent bugs in the future

This commit is contained in:
Eugene Sandulenko 2021-07-13 10:20:19 +02:00
parent 47542c0248
commit c298ece898
No known key found for this signature in database
GPG Key ID: 014D387312D34F08

View File

@ -2039,7 +2039,8 @@ TaskResult HuntTask::update(void) {
}
// If there is a subtask, update it
if (huntFlags & (huntGoto | huntWander)) subTask->update();
if ((huntFlags & (huntGoto | huntWander)) && subTask)
subTask->update();
// If we're not at the target, we know the hunt task is not
// done
@ -2060,6 +2061,7 @@ void HuntTask::removeWanderTask(void) {
void HuntTask::removeGotoTask(void) {
subTask->abortTask();
delete subTask;
subTask = nullptr;
huntFlags &= ~huntGoto;
}