Scripts/HoR: Fix possible array overflow

Fix possible array overflow reported by coverity, issue id 1062436 .

This could be a false positive that might never happen due to the script logic, better handle the case anyway.