Test and fix for GRAILS-10765: NPE in StreamCharBuffer.toCharArray