Many thanks for the report. (How did you find this bug? Just inspection?) I believe this small change should fix the issue:
I found this bug during manual code review. The proposed change should fix the problem. Regards, Xmilia