Index: field.class.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/data/field/file/field.class.php,v
retrieving revision 1.17
diff -u -r1.17 field.class.php
--- mod/data/field/file/field.class.php 26 Feb 2007 06:56:07 -0000 1.17
+++ mod/data/field/file/field.class.php 12 Apr 2008 22:39:02 -0000
@@ -115,10 +115,14 @@
$width = $this->field->param1 ? ' width = "'.s($this->field->param1).'" ':' ';
$height = $this->field->param2 ? ' height = "'.s($this->field->param2).'" ':' ';
- require_once($CFG->libdir.'/filelib.php');
- $icon = mimeinfo('icon', $src);
- $str = '
'.
- ''.$name.'';
+ if (isset($contents[0])) {
+ require_once($CFG->libdir.'/filelib.php');
+ $icon = mimeinfo('icon', $src);
+ $str = '
'.
+ ''.$name.'';
+ } else {
+ $str = '';
+ }
return $str;
}
return false;