MDL-49366 questions: avoid PHP notices from bad pluginfile URLs
authorTim Hunt <T.J.Hunt@open.ac.uk>
Tue, 3 Mar 2015 18:35:21 +0000 (18:35 +0000)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 5 Mar 2015 12:18:20 +0000 (12:18 +0000)
lib/questionlib.php

index eb7c577..912557c 100644 (file)
@@ -1833,6 +1833,9 @@ function question_pluginfile($course, $context, $component, $filearea, $args, $f
 
     $module = $DB->get_field('question_usages', 'component',
             array('id' => $qubaid));
+    if (!$module) {
+        send_file_not_found();
+    }
 
     if ($module === 'core_question_preview') {
         require_once($CFG->dirroot . '/question/previewlib.php');