From 7de5920dd8dd98494df0833e87aa1d1e5d03efcb Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Tue, 3 Jun 2014 10:15:09 +0800 Subject: [PATCH] MDL-44501 mod_data: Only attempt to export files when a file exists. The error only occurs when portfolios are enabled and there is only one field which is a file field. --- mod/data/locallib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/data/locallib.php b/mod/data/locallib.php index 7410091455f..ae182535a3d 100644 --- a/mod/data/locallib.php +++ b/mod/data/locallib.php @@ -348,7 +348,9 @@ class data_portfolio_caller extends portfolio_module_caller_base { $includedfiles = array(); foreach ($fields as $singlefield) { if (is_callable(array($singlefield, 'get_file'))) { - $includedfiles[] = $singlefield->get_file($record->id); + if ($file = $singlefield->get_file($record->id)) { + $includedfiles[] = $file; + } } } if (count($includedfiles) == 1 && count($fields) == 1) {