Fix zero division error on Bom inputs/outputs

issue4055
review13411002
(grafted from 19d1b4b6c5a21ecf3d20e5669b2346df0aea4e3e)

--HG--
branch : 3.0
extra : source : 19d1b4b6c5a21ecf3d20e5669b2346df0aea4e3e