Skip to content

Commit 86c3805

Browse files
author
jessevz
committed
Fixed null pointer bug
1 parent e76d2c5 commit 86c3805

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/inc/utils/AgentUtils.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,12 @@ public static function assign(int $agentId, int $taskId, User $user): ?Assignmen
405405

406406
$qF = new QueryFilter(Agent::AGENT_ID, $agent->getId(), "=");
407407
$assignments = Factory::getAssignmentFactory()->filter([Factory::FILTER => $qF]);
408-
if ($assignments[0]->getTaskId() === $taskId) {
409-
throw new HttpError("Agent is already assigned to this task");
410-
}
411408

412409
$benchmark = 0;
413410
if (sizeof($assignments) > 0) {
411+
if ($assignments[0]->getTaskId() === $taskId) {
412+
throw new HttpError("Agent is already assigned to this task");
413+
}
414414
for ($i = 1; $i < sizeof($assignments); $i++) { // clean up if required
415415
Factory::getAssignmentFactory()->delete($assignments[$i]);
416416
}

0 commit comments

Comments
 (0)