diff --git a/components/ILIAS/COPage/PC/Resources/ResourcesCommandActionHandler.php b/components/ILIAS/COPage/PC/Resources/ResourcesCommandActionHandler.php index 1a59baf54125..29548185e559 100755 --- a/components/ILIAS/COPage/PC/Resources/ResourcesCommandActionHandler.php +++ b/components/ILIAS/COPage/PC/Resources/ResourcesCommandActionHandler.php @@ -78,21 +78,31 @@ protected function insertCommand(array $body): Server\Response $res_type = $body["res_type"]; + $invalid = false; if ($res_type === "_other") { $res->setResourceListType("_other"); } elseif ($res_type === "_lobj") { $res->setResourceListType("_lobj"); } elseif ($res_type !== "itgr") { - $res->setResourceListType( - $body["type"] - ); + if (isset($body["type"])) { + $res->setResourceListType( + $body["type"] + ); + } else { + $invalid = true; + } } else { $res->setItemGroupRefId( - $body["itgr"] + (int) $body["itgr"] ); } - $updated = $page->update(); + if (!$invalid) { + $updated = $page->update(); + } else { + $page->buildDom(true); // rebuild dom (remove changes) + $updated = true; + } return $this->ui_wrapper->sendPage($this->page_gui, $updated); }