Fix potential NPE due to GROOVY-6099 fix