Skip to content

Commit

Permalink
MDL-28687 questions avoid fatal errors when reviewing attempts at del…
Browse files Browse the repository at this point in the history
…eted questions.
  • Loading branch information
timhunt committed Aug 18, 2011
1 parent 4f36324 commit 2a73f86
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/questionlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down

0 comments on commit 2a73f86

Please sign in to comment.