[Notice] Trying to get property of non-object

GET /sixth-form/about-us-2/calendar-3/ics/2636/20190919T183000-20190919T193000

Line 833 in /var/www/vhosts/bishopluffa.org.uk/public_html/event_calendar/code/Calendar.php

Source

824 			$id = str_replace("announcement-","",$id);
825 			$announcement = true;
826 		}
827 		else {			
828 			$announcement = false;
829 		}
830 		if(is_numeric($id) && $oid) {
831 			if(!$feed) { 
832 				$event = DataObject::get_by_id($announcement ? $this->data()->getDateTimeClass() : $this->data()->getEventClass(), $id);
833 				$FILENAME = $announcement ? preg_replace("/[^a-zA-Z0-9s]/", "", $event->Title) : $event->URLSegment;
834 			}
835 			else {
836 				$FILENAME = preg_replace("/[^a-zA-Z0-9s]/", "", urldecode($_REQUEST['title']));
837 			}
838 
839 			$FILENAME .= ".ics";

Trace