diff --git a/lib/filesystem/FileManager.php b/lib/filesystem/FileManager.php
index 21eb27aec20742ed75a6f874f9bf3343e10ffab7..55cd769bc7f0e8b72fa25e91d1da42d025df97b0 100644
--- a/lib/filesystem/FileManager.php
+++ b/lib/filesystem/FileManager.php
@@ -1060,7 +1060,7 @@ class FileManager
         }
 
         $new_folder = null;
-        if ($source_folder instanceof StandardFolder) {
+        if (($source_folder instanceof StandardFolder) && ($destination_folder instanceof StandardFolder)) {
             //Standard folders just have to be put below the
             //destination folder.
             $new_folder = $destination_folder->createSubfolder($source_folder);