From: scyrma Date: Tue, 9 Sep 2008 09:08:43 +0000 (+0000) Subject: MDL-15405: missing check X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=eb37800b50a69ee66ff329616201ee4fab71818c;p=moodle.git MDL-15405: missing check --- diff --git a/lib/filelib.php b/lib/filelib.php index bc49323679..b0b96df8ed 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -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 .'/'; }