Skip to content

Commit

Permalink
MYFACES-4611: Avoid NPE when root is null
Browse files Browse the repository at this point in the history
  • Loading branch information
pnicolucci committed Jul 12, 2023
1 parent b187b54 commit 3855c1e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,13 @@ public ViewPool getViewPool(FacesContext context, UIViewRoot root)

public boolean isViewPoolEnabledForThisView(FacesContext context, UIViewRoot root)
{
if (root.isTransient())
if (root == null || root.isTransient())
{
// Stateless views cannot be pooled, because we are reusing
// state saving algorithm for that.
return false;
}

Boolean enableViewPool = (Boolean) root.getAttributes().get(ViewPoolProcessor.ENABLE_VIEW_POOL);
if (enableViewPool != null)
{
Expand All @@ -259,6 +260,7 @@ public boolean isViewPoolEnabledForThisView(FacesContext context, UIViewRoot roo
return true;
}
}

return false;
}

Expand Down

0 comments on commit 3855c1e

Please sign in to comment.