Bugfix and simplify algorithm for selecting field pass method
Bugfix and simplify algorithm for selecting field pass method

For messages with no field it would cause a badarith error due to
division by zero.

olgeni/gpb,mmmries/gpb