Skip to content

Commit

Permalink
Add empty value check (#1529)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextselegidis committed May 21, 2024
1 parent 3f39861 commit 7713f3f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions application/models/Providers_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,13 @@ public function save_working_plan_exception(
array $working_plan_exception = null,
): void {
// Validate the working plan exception data.

if (empty($working_plan_exception['start']) || empty($working_plan_exception['end'])) {
throw new InvalidArgumentException(
'Empty start and/or end time provided: ' . json_encode($working_plan_exception),
);
}

$start = date('H:i', strtotime($working_plan_exception['start']));

$end = date('H:i', strtotime($working_plan_exception['end']));
Expand Down

0 comments on commit 7713f3f

Please sign in to comment.