Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…eted questions.
  • Loading branch information...
commit 2a73f863ffc3b2da65355f1132485ed18ff3ae07 1 parent 4f36324
Tim Hunt timhunt authored

Showing 1 changed file with 5 additions and 0 deletions. Show diff stats Hide diff stats

  1. +5 0 lib/questionlib.php
5 lib/questionlib.php
@@ -1343,6 +1343,11 @@ function question_has_capability_on($question, $cap, $cachecat = -1) {
1343 1343 }
1344 1344 $question = $questions[$question];
1345 1345 }
  1346 + if (empty($question->category)) {
  1347 + // This can happen when we have created a fake 'missingtype' question to
  1348 + // take the place of a deleted question.
  1349 + return false;
  1350 + }
1346 1351 if (!isset($categories[$question->category])) {
1347 1352 if (!$categories[$question->category] = $DB->get_record('question_categories',
1348 1353 array('id'=>$question->category))) {

0 comments on commit 2a73f86

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