Skip to content
Snippets Groups Projects
Commit 7c73f121 authored by Marcus Eibrink-Lunzenauer's avatar Marcus Eibrink-Lunzenauer
Browse files

Defend against missing home institutes.

Refs #443.
parent f09df232
No related branches found
No related tags found
No related merge requests found
......@@ -88,12 +88,16 @@ class Course extends SchemaProvider
*/
private function getInstitute(\Course $course, $shouldInclude)
{
return [
self::LINKS => [
Link::RELATED => new Link('/institutes/'.$course->institut_id),
],
self::DATA => $course->home_institut,
];
return $course->institut_id
? [
self::LINKS => [
Link::RELATED => new Link('/institutes/' . $course->institut_id),
],
self::DATA => $course->home_institut,
]
: [
self::DATA => null,
];
}
private function getStartSemester(\Course $course)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment