examples: Fix possible division by zero

This commit is contained in:
Tatsuhiro Tsujikawa 2014-07-18 00:09:05 +09:00
parent 5c305acb97
commit 39498beffd
1 changed files with 1 additions and 1 deletions

View File

@ -133,7 +133,7 @@ static void deflate(nghttp2_hd_deflater *deflater,
outlen = rv; outlen = rv;
printf("\nDeflate (%zu byte(s), ratio %.02f):\n\n", printf("\nDeflate (%zu byte(s), ratio %.02f):\n\n",
outlen, (double)outlen / sum); outlen, sum == 0 ? 0 : (double)outlen / sum);
for(i = 0; i < outlen; ++i) { for(i = 0; i < outlen; ++i) {
if((i & 0x0fu) == 0) { if((i & 0x0fu) == 0) {