Browse Source

Fix fatal when obj not found see BT#12714

jmontoyaa 7 years ago
parent
commit
a74678343d
1 changed files with 6 additions and 2 deletions
  1. 6 2
      main/cron/import_csv.php

+ 6 - 2
main/cron/import_csv.php

@@ -959,9 +959,13 @@ class ImportCsv
                 $event['update'] = $update;
                 $event['item'] = $item;
 
+                $calendarEvent = null;
                 /* Check if event changed of course code */
-                /** @var CCalendarEvent $calendarEvent */
-                $calendarEvent = $em->getRepository('ChamiloCourseBundle:CCalendarEvent')->find($item['item_id']);
+                if (!empty($item) && isset($item['item_id']) && !empty($item['item_id'])) {
+                    /** @var CCalendarEvent $calendarEvent */
+                    $calendarEvent = $em->getRepository('ChamiloCourseBundle:CCalendarEvent')->find($item['item_id']);
+                }
+
                 if ($calendarEvent) {
                     $this->logger->addInfo('Calendar event found '.$item['item_id']);
                     if ($calendarEvent->getCId() != $courseInfo['real_id']) {