Skip to content

[BUGFIX] Avoid method calls on null with use of null safe operators#1359

Merged
mschwemer merged 1 commit intoin2code-de:masterfrom
alexanderschnitzler:patch-1
Mar 10, 2026
Merged

[BUGFIX] Avoid method calls on null with use of null safe operators#1359
mschwemer merged 1 commit intoin2code-de:masterfrom
alexanderschnitzler:patch-1

Conversation

@alexanderschnitzler
Copy link
Contributor

FrontendUtility::getCurrentPageIdentifier() and
FrontendUtility::getSysLanguageUid() received a guard clause a while ago to prevent calling getAttribute() on a null request.

While this solves issues with a nullable request, there are still potential issues with calling a method on a null return value of getAttribute()

The use of null-safe operators resolve this issue and make the guard clauses superfluous.

Fixes: #1358

`FrontendUtility::getCurrentPageIdentifier()` and
`FrontendUtility::getSysLanguageUid()` received a guard clause a while ago
to prevent calling `getAttribute()` on a null request.

While this solves issues with a nullable request, there are still
potential issues with calling a method on a null return value of
`getAttribute()`

The use of null-safe operators resolve this issue and make the guard
clauses superfluous.

Fixes: in2code-de#1358
@mschwemer mschwemer merged commit 915a8b2 into in2code-de:master Mar 10, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Call to a member function getId() on null

2 participants