Skip to content

Commit a438230

Browse files
committed
IndexOutOfRangeException
1 parent f3385b7 commit a438230

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Assets/Hypertext/Scripts/HypertextBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ void GenerateHrefBoundingBoxes(ref List<UIVertex> vertices)
181181
var startIndex = visibleCharIndexMap[span.StartIndex];
182182
var endIndex = visibleCharIndexMap[span.StartIndex + span.Length - 1];
183183

184-
startIndex = Mathf.Clamp(startIndex, 0, visibleCharIndexMap.Last());
185-
endIndex = Mathf.Clamp(endIndex, 0, visibleCharIndexMap.Last());
184+
startIndex = Mathf.Clamp(startIndex, 0, text.Length - 1);
185+
endIndex = Mathf.Clamp(endIndex, 0, text.Length - 1);
186186

187187
for (var textIndex = startIndex; textIndex <= endIndex; textIndex++)
188188
{

0 commit comments

Comments
 (0)