mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-28687 questions avoid fatal errors when reviewing attempts at deleted questions.
This commit is contained in:
parent
4f3632441a
commit
2a73f863ff
1 changed files with 5 additions and 0 deletions
|
@ -1343,6 +1343,11 @@ function question_has_capability_on($question, $cap, $cachecat = -1) {
|
|||
}
|
||||
$question = $questions[$question];
|
||||
}
|
||||
if (empty($question->category)) {
|
||||
// This can happen when we have created a fake 'missingtype' question to
|
||||
// take the place of a deleted question.
|
||||
return false;
|
||||
}
|
||||
if (!isset($categories[$question->category])) {
|
||||
if (!$categories[$question->category] = $DB->get_record('question_categories',
|
||||
array('id'=>$question->category))) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue