Skip to content
Snippets Groups Projects
Commit a3c8a524 authored by David Siegfried's avatar David Siegfried
Browse files

prevent php-warnings, closes #2284

Closes #2284

Merge request studip/studip!1508
parent 9beb0e6d
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ trait CoursewareInstancesHelper ...@@ -32,6 +32,7 @@ trait CoursewareInstancesHelper
if (!($method = $methods[$rangeType])) { if (!($method = $methods[$rangeType])) {
throw new BadRequestException('Invalid range type: "' . $rangeType . '".'); throw new BadRequestException('Invalid range type: "' . $rangeType . '".');
} }
$root = null; $root = null;
if ($rangeType !== 'sharedusers') { if ($rangeType !== 'sharedusers') {
$chunks = explode('_', $rangeId); $chunks = explode('_', $rangeId);
...@@ -45,7 +46,9 @@ trait CoursewareInstancesHelper ...@@ -45,7 +46,9 @@ trait CoursewareInstancesHelper
} else { } else {
$unit = Unit::findOneBySQL('range_id = ?', [$courseId]); $unit = Unit::findOneBySQL('range_id = ?', [$courseId]);
} }
$root = $unit->structural_element; if ($unit) {
$root = $unit->structural_element;
}
} else { } else {
$root = StructuralElement::$method($rangeId); $root = StructuralElement::$method($rangeId);
} }
......
...@@ -197,7 +197,7 @@ abstract class ContainerType ...@@ -197,7 +197,7 @@ abstract class ContainerType
foreach ($payload['sections'] as &$section) { foreach ($payload['sections'] as &$section) {
foreach ($section['blocks'] as &$block) { foreach ($section['blocks'] as &$block) {
$block = $block_map[$block]; $block = $block_map[$block] ?? null;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment