fixed index outside bounds of the array when 0 productions left

closes #4137
Merge pull request #4149 from Mailaender/speedup-array-bounds

Fixed crash when the last production building was killed while the mouse was still hovering over the build palette