From 55963a3a29a5a85d9d0ed84d6340392039ff6309 Mon Sep 17 00:00:00 2001 From: danmarsden Date: Tue, 11 Mar 2008 19:01:34 +0000 Subject: [PATCH] MDL-13892 partial fix - check var first before using! --- mod/choice/lib.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 { -- 2.39.5