SI-7385 crash in erroneous code

Less crashing, more emitting errors.
Merge pull request #2472 from paulp/pr/2.10.2/7385

SI-7385 crash in erroneous code