diff --git a/lib/formslib.php b/lib/formslib.php
index <HASH>..<HASH> 100644
--- a/lib/formslib.php
+++ b/lib/formslib.php
@@ -214,7 +214,7 @@ class moodleform {
                     }
                     $errors[$elname] = $this->_upload_manager->files[$elname]['uploadlog'];
 
-                } else if ($this->_upload_manager->files[$elname]['clear']) {
+                } else if (!empty($this->_upload_manager->files[$elname]['clear'])) {
                     $files[$elname] = $this->_upload_manager->files[$elname]['tmp_name'];
                 }
             } else {
fixes notice error caused in form validation of file attachments - need not assume variable is set but use empty()