Skip to content

Commit

Permalink
fix(filefield): mandatory check may cause exception
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Aug 3, 2022
1 parent bffcb5b commit 3f711a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inc/field/filefield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function isValid(): bool {

// If the field is required it can't be empty
$key = '_formcreator_field_' . $this->question->getID();
if (($this->isRequired() && count($this->uploads[$key]) < 1)) {
if (($this->isRequired() && (!isset($this->uploads[$key]) || count($this->uploads[$key]) < 1))) {
Session::addMessageAfterRedirect(
sprintf(__('A required file is missing: %s', 'formcreator'), $this->getLabel()),
false,
Expand Down

0 comments on commit 3f711a5

Please sign in to comment.