Fix for GROOVY-6706.  NPE in some certain situations with @BaseScript.