[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm

raeburn raeburn at source.lon-capa.org
Tue Dec 18 11:48:20 EST 2012


raeburn		Tue Dec 18 16:48:20 2012 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  - Sanity checking.
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.335 loncom/homework/lonhomework.pm:1.336
--- loncom/homework/lonhomework.pm:1.335	Wed Dec 21 21:25:36 2011
+++ loncom/homework/lonhomework.pm	Tue Dec 18 16:48:19 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.335 2011/12/21 21:25:36 www Exp $
+# $Id: lonhomework.pm,v 1.336 2012/12/18 16:48:19 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -790,7 +790,7 @@
 	(my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2);
 	my %analyze=&Apache::lonnet::str2hash($subresult);
 	my @parts;
-	if (defined(@{ $analyze{'parts'} })) {
+        if (ref($analyze{'parts'}) eq 'ARRAY') {
 	    @parts=@{ $analyze{'parts'} };
 	}
 	foreach my $part (@parts) {
@@ -830,7 +830,8 @@
                    .'</h3>'
     );
     foreach my $part (sort(keys(%allparts))) {
-	if (defined(@{ $overall{$part.'.answer'} })) {
+        if ((ref($overall{$part.'.answer'}) eq 'ARRAY') &&
+            (@{$overall{$part.'.answer'}} > 0)) {
 	    for (my $i=0;$i<scalar(@{ $overall{$part.'.answer'} });$i++) {
 		my $num_cols=scalar(@{ $overall{$part.'.answer'}[$i][0] });
                 $request->print(&Apache::loncommon::start_data_table()




More information about the LON-CAPA-cvs mailing list