From: danmarsden <danmarsden> Date: Tue, 11 Mar 2008 19:01:34 +0000 (+0000) Subject: MDL-13892 partial fix - check var first before using! X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=55963a3a29a5a85d9d0ed84d6340392039ff6309;p=moodle.git MDL-13892 partial fix - check var first before using! --- diff --git a/mod/choice/lib.php b/mod/choice/lib.php index 1feb6bfb03..51ea48b4e0 100644 --- a/mod/choice/lib.php +++ b/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 {