]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13892 partial fix - check var first before using!
authordanmarsden <danmarsden>
Tue, 11 Mar 2008 19:01:34 +0000 (19:01 +0000)
committerdanmarsden <danmarsden>
Tue, 11 Mar 2008 19:01:34 +0000 (19:01 +0000)
mod/choice/lib.php

index 1feb6bfb03bf2fd5fcb3d2dbdd76637d12bc6db9..51ea48b4e0f00d87fcb9c883e62d668d5d2f8c61 100644 (file)
@@ -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 {