From eb37800b50a69ee66ff329616201ee4fab71818c Mon Sep 17 00:00:00 2001 From: scyrma Date: Tue, 9 Sep 2008 09:08:43 +0000 Subject: [PATCH] MDL-15405: missing check --- lib/filelib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 .'/'; } -- 2.39.5