Bugfix: prevent floating point exception when encoding/decoding 0-sized data (edge case).
Bugfix: prevent floating point exception when encoding/decoding 0-sized data (edge case).

(cherry picked from commit e064c295ad9211e2ea6ff044686f14cb3f246877)

mttbernardini/mbc,mttbernardini/mbc