Fix COCOON-1744 NullPointerException in template block. Thanks to Tim Williams (williamstw@gmail.com).