Improve formatting in SelectFormField::validate()
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 4 May 2023 08:28:12 +0000 (10:28 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 4 May 2023 08:28:12 +0000 (10:28 +0200)
wcfsetup/install/files/lib/system/form/builder/field/SelectFormField.class.php

index 6d997a37c431971b8c1635440f14e9d2cf392c48..26015d2b3f834ba630a6314cc019219bc93acf0f 100644 (file)
@@ -55,11 +55,13 @@ final class SelectFormField extends AbstractFormField implements
             if ($this->isRequired()) {
                 $this->addValidationError(new FormFieldValidationError('empty'));
             }
-        } else if (!isset($this->getOptions()[$this->getValue()])) {
-            $this->addValidationError(new FormFieldValidationError(
-                'invalidValue',
-                'wcf.global.form.error.noValidSelection'
-            ));
+        } else {
+            if (!isset($this->getOptions()[$this->getValue()])) {
+                $this->addValidationError(new FormFieldValidationError(
+                    'invalidValue',
+                    'wcf.global.form.error.noValidSelection'
+                ));
+            }
         }
 
         parent::validate();