diff --git a/question/format/xhtml/format.php b/question/format/xhtml/format.php
index 256db705340..21db81d0951 100644
--- a/question/format/xhtml/format.php
+++ b/question/format/xhtml/format.php
@@ -130,11 +130,13 @@ class qformat_xhtml extends qformat_default {
foreach($question->options->subquestions as $subquestion) {
// build drop down for answers
$quest_text = $this->repchar( $subquestion->questiontext );
- $dropdown = html_writer::label(get_string('answer', 'qtype_match', $option+1), 'quest_'.$id.'_'.$option, false, array('class' => 'accesshide'));
- $dropdown .= html_writer::select($selectoptions, "quest_{$id}_{$option}", '', false, array('id' => "quest_{$id}_{$option}"));
- $expout .= html_writer::tag('li', $quest_text);
- $expout .= $dropdown;
- $option++;
+ if ($quest_text != '') {
+ $dropdown = html_writer::label(get_string('answer', 'qtype_match', $option+1), 'quest_'.$id.'_'.$option, false, array('class' => 'accesshide'));
+ $dropdown .= html_writer::select($selectoptions, "quest_{$id}_{$option}", '', false, array('id' => "quest_{$id}_{$option}"));
+ $expout .= html_writer::tag('li', $quest_text);
+ $expout .= $dropdown;
+ $option++;
+ }
}
$expout .= html_writer::end_tag('ul');
break;