--- loncom/homework/optionresponse.pm 2012/06/25 10:36:00 1.186 +++ loncom/homework/optionresponse.pm 2012/10/12 12:45:46 1.187 @@ -1,7 +1,7 @@ # LearningOnline Network with CAPA # option list style responses # -# $Id: optionresponse.pm,v 1.186 2012/06/25 10:36:00 foxr Exp $ +# $Id: optionresponse.pm,v 1.187 2012/10/12 12:45:46 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -427,8 +427,11 @@ sub whichfoils { sub displayanswers { my ($max,$randomize,@opt)=@_; - if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;} - my @names = @{ $Apache::response::foilgroup{'names'} }; + my @names; + if (ref($Apache::response::foilgroup{'names'}) eq 'ARRAY') { + @names = @{ $Apache::response::foilgroup{'names'} }; + } + return if (!@names); my @whichopt = &whichfoils($max,$randomize); my $result; if ($Apache::lonhomework::type eq 'exam') {