Skip to content
Browse files

MDL-15693 - print_question_icon does not cope with missing question t…

…ypes
  • Loading branch information...
1 parent 1be35ac commit 9db58d015fe764af6da8dbec18666697e8bfc0c6 tjhunt committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/questionlib.php
View
6 lib/questionlib.php
@@ -1292,7 +1292,11 @@ function question_apply_penalty_and_timelimit(&$question, &$state, $attempt, $cm
function print_question_icon($question, $return = false) {
global $QTYPES, $CFG;
- $namestr = $QTYPES[$question->qtype]->menu_name();
+ if (array_key_exists($question->qtype, $QTYPES)) {
+ $namestr = $QTYPES[$question->qtype]->menu_name();
+ } else {
+ $namestr = 'missingtype';
+ }
$html = '<img src="' . $CFG->wwwroot . '/question/type/' .
$question->qtype . '/icon.gif" alt="' .
$namestr . '" title="' . $namestr . '" />';

0 comments on commit 9db58d0

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