Skip to content

Commit

Permalink
Guard for divide by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Jan 29, 2019
1 parent a5f02c3 commit a35fb23
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion DirectXTex/DirectXTexMipmaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ namespace
pSrcRow0 = pSrcRow1;
}

coverage = static_cast<float>(coverageCount) / static_cast<float>((srcImage.width - 1) * (srcImage.height - 1) * N * N);
float cscale = static_cast<float>((srcImage.width - 1) * (srcImage.height - 1) * N * N);
if (cscale > 0.f)
{
coverage = static_cast<float>(coverageCount) / cscale;
}

return S_OK;
}
Expand Down

0 comments on commit a35fb23

Please sign in to comment.