fix Issue 12501 - Assertion `global.gaggedErrors || global.errors' failed.
Merge pull request #3414 from 9rnsr/fix12501

[REG2.066a] Issue 12501 - Assertion `global.gaggedErrors || global.errors' failed.