fix Issue 12002 - Internal error: toir.c 181
Merge pull request #3159 from 9rnsr/fix12002

[REG] Issue 12002 - Internal error: toir.c 181