Skip to content

Commit

Permalink
BACKLOG-23210 Check for null
Browse files Browse the repository at this point in the history
  • Loading branch information
AKarmanov committed Nov 4, 2024
1 parent 5594591 commit 35e0d6b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class GqlJContentMutations {

@GraphQLField
@GraphQLName("flushPageCache")
@GraphQLDescription("Flushes cache for a page, checks permission and node type")
@GraphQLDescription("Flushes cache for a page, checks adminCache permission and node type")
public Boolean flushPageCache(@GraphQLNonNull @GraphQLName("pagePath") @GraphQLDescription("Page path") String pagePath) {
JCRNodeWrapper node = null;

Expand All @@ -61,7 +61,7 @@ public Boolean flushPageCache(@GraphQLNonNull @GraphQLName("pagePath") @GraphQLD

@GraphQLField
@GraphQLName("flushSiteCache")
@GraphQLDescription("Flushes cache for a site, will resolve site node if the path supplied is not a site, checks permission")
@GraphQLDescription("Flushes cache for a site, will resolve site node if the path supplied is not a site, checks adminCache permission")
public Boolean flushSiteCache(@GraphQLNonNull @GraphQLName("sitePath") @GraphQLDescription("Site path") String sitePath) {
JCRNodeWrapper node = null;

Expand All @@ -73,8 +73,10 @@ public Boolean flushSiteCache(@GraphQLNonNull @GraphQLName("sitePath") @GraphQLD
node = JCRContentUtils.getParentOfType(node, "jnt:virtualsite");
}

CacheHelper.flushOutputCachesForPath(node.getPath(), true);
return true;
if (node != null) {
CacheHelper.flushOutputCachesForPath(node.getPath(), true);
return true;
}
}
} catch (RepositoryException e) {
throw new DataFetchingException(e);
Expand Down

0 comments on commit 35e0d6b

Please sign in to comment.