--- loncom/homework/essayresponse.pm	2011/07/26 17:14:51	1.115
+++ loncom/homework/essayresponse.pm	2011/10/17 12:41:35	1.116
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.115 2011/07/26 17:14:51 raeburn Exp $
+# $Id: essayresponse.pm,v 1.116 2011/10/17 12:41:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -397,8 +397,11 @@ sub file_submission {
                 my ($path,$filename) = ($file =~ m{^(.*/)([^/]+)$});
                 my $fullpath = '/userfiles/portfolio'.$path;
                 if (!exists($dirlist{$fullpath})) {
-                    my @list = &Apache::lonnet::dirlist($fullpath,$udom,$uname,1);
-                    $dirlist{$fullpath} = \@list;
+                    my ($listref,$listerror) =
+                        &Apache::lonnet::dirlist($fullpath,$udom,$uname,1);
+                    if (ref($listref) eq 'ARRAY') {
+                        $dirlist{$fullpath} = $listref;
+                    }
                 }
                 if (ref($dirlist{$fullpath}) eq 'ARRAY') {
                     foreach my $dir_line (@{$dirlist{$fullpath}}) {