Avoid out-of-bounds array index

This commit is contained in:
Paul Cornett
2019-04-05 10:10:07 -07:00
parent 9299f9f1d8
commit 1bba25c7ee

View File

@@ -183,7 +183,7 @@ namespace
int CTWeightToWX(CGFloat weight) int CTWeightToWX(CGFloat weight)
{ {
for (int i = 0; i < kCTWeightsCount; ++i) for (int i = 0; i < kCTWeightsCount - 1; ++i)
{ {
if ( (weight - gCTWeights[i]) < (gCTWeights[i+1]-weight) ) if ( (weight - gCTWeights[i]) < (gCTWeights[i+1]-weight) )
return i * 100; return i * 100;