Add missing checks in FileOptionType
authorMatthias Schmidt <gravatronics@live.com>
Tue, 23 Dec 2014 08:07:31 +0000 (09:07 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 23 Dec 2014 08:07:31 +0000 (09:07 +0100)
wcfsetup/install/files/lib/system/option/FileOptionType.class.php

index 53d190c75e63252e5722a71c32a6da9f48a4a5fa..edb361e1435c5f0d27a2da912d42af1b57164e28 100644 (file)
@@ -42,6 +42,9 @@ class FileOptionType extends AbstractOptionType {
         */
        public function getData(Option $option, $newValue) {
                $this->createUploadHandler($option);
+               if ($this->uploadHandlers[$option->optionName] === null) {
+                       return '';
+               }
                
                $files = $this->uploadHandlers[$option->optionName]->getFiles();
                $file = reset($files);
@@ -91,6 +94,9 @@ class FileOptionType extends AbstractOptionType {
         */
        public function validate(Option $option, $newValue) {
                $this->createUploadHandler($option);
+               if ($this->uploadHandlers[$option->optionName] === null) {
+                       return;
+               }
                
                $files = $this->uploadHandlers[$option->optionName]->getFiles();
                $file = reset($files);