Skip to content
Browse files

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

…eted questions.
  • Loading branch information...
1 parent 4f36324 commit 2a73f863ffc3b2da65355f1132485ed18ff3ae07 @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 2a73f86

Please sign in to comment.
Something went wrong with that request. Please try again.