fix: prevent NPE in AccountLoader when theme is unavailable#48813
Open
lukman48 wants to merge 1 commit intokeycloak:mainfrom
Open
fix: prevent NPE in AccountLoader when theme is unavailable#48813lukman48 wants to merge 1 commit intokeycloak:mainfrom
lukman48 wants to merge 1 commit intokeycloak:mainfrom
Conversation
…#48806) When the ACCOUNT_V3 feature is disabled, accessing the account console endpoint throws a NullPointerException in AccountLoader.getAccountResourceProvider() because the theme parameter can be null, but the code unconditionally calls theme.getProperties(). Add null check before accessing theme properties to handle the case gracefully when the account theme is unavailable (e.g., when account feature is disabled). Fixes keycloak#48806 Signed-off-by: lukman48 <lukman_uki@yahoo.co.id>
f6bde83 to
f57c6ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #48806 - NPE when accessing Account UI and the ACCOUNT feature is disabled
Problem
When the
ACCOUNT_V3feature is disabled, accessing the account console endpoint throws aNullPointerExceptioninAccountLoader.getAccountResourceProvider().Root Cause
The
themeparameter passed togetAccountResourceProvider()can benullwhen the account theme is unavailable (e.g., when account-v3 feature is disabled), but the method unconditionally callstheme.getProperties()without a null check.Stack Trace
Solution
Add a null check before accessing theme properties:
This allows the method to gracefully handle the case when theme is null by returning the default provider.
Testing
Manual Test Steps
--features-disabled=account-v3Expected Behavior
Impact
Related Labels:
kind/bug,area/account/api,priority/normal,help wanted