Skip to content

Commit 8641e53

Browse files
committed
Don't move cursor forward when it points after last character.
1 parent 3a9fb02 commit 8641e53

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

source/text/implementation/vss-implementation-text_handlers-utf8-dynamic.adb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,9 @@ package body VSS.Implementation.Text_Handlers.UTF8.Dynamic is
576576
return;
577577
end if;
578578

579-
Unchecked_Forward (Self.Pointer.Storage, After);
579+
if To.Index <= Self.Length then
580+
Unchecked_Forward (Self.Pointer.Storage, After);
581+
end if;
580582

581583
Size := After.UTF8_Offset - From.UTF8_Offset;
582584
Length := After.Index - From.Index;

source/text/implementation/vss-implementation-text_handlers-utf8-static.adb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,9 @@ package body VSS.Implementation.Text_Handlers.UTF8.Static is
515515
return;
516516
end if;
517517

518-
Unchecked_Forward (Self.Storage, After);
518+
if To.Index <= Self.Length then
519+
Unchecked_Forward (Self.Storage, After);
520+
end if;
519521

520522
Size := After.UTF8_Offset - From.UTF8_Offset;
521523
Length := After.Index - From.Index;

0 commit comments

Comments
 (0)