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
1 merge request!4Draft: Icon creation
......@@ -32,6 +32,7 @@ trait CoursewareInstancesHelper
if (!($method = $methods[$rangeType])) {
throw new BadRequestException('Invalid range type: "' . $rangeType . '".');
}
$root = null;
if ($rangeType !== 'sharedusers') {
$chunks = explode('_', $rangeId);
......@@ -45,7 +46,9 @@ trait CoursewareInstancesHelper
} else {
$unit = Unit::findOneBySQL('range_id = ?', [$courseId]);
}
$root = $unit->structural_element;
if ($unit) {
$root = $unit->structural_element;
}
} else {
$root = StructuralElement::$method($rangeId);
}
......
......@@ -197,7 +197,7 @@ abstract class ContainerType
foreach ($payload['sections'] as &$section) {
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.
Finish editing this message first!
Please register or to comment