]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15405: missing check
authorscyrma <scyrma>
Tue, 9 Sep 2008 09:08:43 +0000 (09:08 +0000)
committerscyrma <scyrma>
Tue, 9 Sep 2008 09:08:43 +0000 (09:08 +0000)
lib/filelib.php

index bc493236797054ff5aff25f330b276649a4fac6d..b0b96df8ed42e7f68ea359ee79eae1a502644905 100644 (file)
@@ -150,7 +150,7 @@ function file_rewrite_urls($text, $contextid, $filepath, $filearea, $itemid, $cu
         // if a new upload has the same file path/name as an existing file, but different content, we put it in a distinct path.
         $existingfile = $fs->get_file($currentcontextid, $currentfilearea, $currentitemid, $currentfilepath, $currentfilename);
         $uploadedfile = $fs->get_file($contextid, $filearea, $itemid, $filepath, $currentfilename);
-        if ($existingfile->get_contenthash() != $uploadedfile->get_contenthash()) {
+        if ($existingfile && $uploadedfile && ($existingfile->get_contenthash() != $uploadedfile->get_contenthash())) {
             $filepath .= $currentitemid .'/';
         }