HPCC-8907 Fix potential core/internal error constant folding CASE

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Merge pull request #4048 from ghalliday/issue8907

HPCC-8907 Fix potential core/internal error constant folding CASE

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>