Browse files

MDL-28687 questions avoid fatal errors when reviewing attempts at del…

…eted questions.
  • Loading branch information...
1 parent 24654d9 commit 3575052f81a64d865c94eefc1765aba254bd9eee @timhunt timhunt committed Aug 16, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/questionlib.php
View
5 lib/questionlib.php
@@ -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))) {

0 comments on commit 3575052

Please sign in to comment.