diff --git lib/filelib.php lib/filelib.php
index 0f879fc..aad2d8c 100644
--- lib/filelib.php
+++ lib/filelib.php
@@ -2227,8 +2227,11 @@ function fulldelete($location) {
     }
     if (is_dir($location)) {
         $currdir = opendir($location);
+        if (false === $currdir) {
+            return false;
+        }
         while (false !== ($file = readdir($currdir))) {
-            if ($file <> ".." && $file <> ".") {
+            if ($file <> ".." && $file <> "." && $file <> "") {
                 $fullfile = $location."/".$file;
                 if (is_dir($fullfile)) {
                     if (!fulldelete($fullfile)) {
