From 0a14f6f3fc344f87d1691e800eea24d34b0cc558 Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 23 Jun 2011 21:31:09 +0000 Subject: [PATCH] Check for index in range before returning CPIS value. --- PROMS/Volian.Utils.Library/CvtFont/CvtFont.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Utils.Library/CvtFont/CvtFont.cs b/PROMS/Volian.Utils.Library/CvtFont/CvtFont.cs index 4d6018d4..56ece2e2 100644 --- a/PROMS/Volian.Utils.Library/CvtFont/CvtFont.cs +++ b/PROMS/Volian.Utils.Library/CvtFont/CvtFont.cs @@ -282,7 +282,10 @@ namespace CvtFont public static float GetCPIs(uint i) { if (FontIsPropt(i)) return 12; - return CPIS[i & 63]; + uint j = i & 63; + if (j > CPIS.Length - 1) + return CPIS[0]; + return CPIS[j]; } public static float GetPrintPitch(uint i) {