Check if get_errors() exists before calling it to prevent fatal error

This commit is contained in:
Nathan Gray 2011-01-11 18:06:28 +00:00
parent 91a5f43670
commit 5e9d01e176

View File

@ -309,7 +309,7 @@
fwrite(STDERR,'importexport_schedule: ' . date('c') . ": Definition not found! \n"); fwrite(STDERR,'importexport_schedule: ' . date('c') . ": Definition not found! \n");
} }
if($po->get_errors()) { if(method_exists($po, 'get_errors') && $po->get_errors()) {
$data['errors'] = $po->get_errors(); $data['errors'] = $po->get_errors();
fwrite(STDERR, 'importexport_schedule: ' . date('c') . ": Import errors:\n#\tError\n"); fwrite(STDERR, 'importexport_schedule: ' . date('c') . ": Import errors:\n#\tError\n");
foreach($po->get_errors() as $record => $error) { foreach($po->get_errors() as $record => $error) {