Return 0 instead of nil on sum with no matches.

[ fix #2678 ]