Skip to content

Commit c160acd

Browse files
committed
check whether module parameter is set
1 parent 63b527f commit c160acd

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

modules/mod_login/src/Helper/LoginHelper.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,23 @@ class LoginHelper
4141
*/
4242
public function getReturnUrlString(Registry $params, $type, CMSApplicationInterface $app): string
4343
{
44-
$item = $app->getMenu()->getItem($params->get($type));
45-
4644
// Stay on the same page
4745
$url = Uri::getInstance()->toString();
4846

49-
if ($item) {
50-
$lang = '';
47+
$returnMenuId = $params->get($type, 0);
5148

52-
if ($item->language !== '*' && Multilanguage::isEnabled()) {
53-
$lang = '&lang=' . $item->language;
54-
}
49+
if ($returnMenuId > 0) {
50+
$item = $app->getMenu()->getItem($returnMenuId);
51+
52+
if ($item) {
53+
$lang = '';
5554

56-
$url = 'index.php?Itemid=' . $item->id . $lang;
55+
if ($item->language !== '*' && Multilanguage::isEnabled()) {
56+
$lang = '&lang=' . $item->language;
57+
}
58+
59+
$url = 'index.php?Itemid=' . $item->id . $lang;
60+
}
5761
}
5862

5963
return base64_encode($url);

0 commit comments

Comments
 (0)