Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-13892 partial fix - check var first before using!

  • Loading branch information...
commit 320ce836d1a8271b7478942d3f99121957f8e72e 1 parent 673e73d
danmarsden authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 mod/choice/lib.php
View
7 mod/choice/lib.php
@@ -144,8 +144,11 @@ function choice_show_form($choice, $user, $cm, $allresponses) {
$cdisplay[$aid]->optionid = $optionid;
$cdisplay[$aid]->text = $text;
$cdisplay[$aid]->maxanswers = $choice->maxanswers[$optionid];
- $cdisplay[$aid]->countanswers = count($allresponses[$optionid]);
-
+ if (isset($allresponses[$optionid])) {
+ $cdisplay[$aid]->countanswers = count($allresponses[$optionid]);
+ } else {
+ $cdisplay[$aid]->countanswers = 0;
+ }
if ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $user->id, 'optionid', $optionid)) {
$cdisplay[$aid]->checked = ' checked="checked" ';
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.