Fix a crash bug when weight is 0

[groonga-dev,02534]

Reported by GMO Media, Inc.. Thanks!!!