Skip to content

Commit 841bbb8

Browse files
committed
fix #213: Fix a build error in the str_at instruction
1 parent 0ca97e4 commit 841bbb8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/engine/virtualmachine_p.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -653,12 +653,14 @@ do_list_get_item : {
653653

654654
do_str_at : {
655655
size_t index = READ_REG(1, 2)->toLong() - 1;
656-
std::u16string str = READ_REG(0, 2)->toUtf16();
657-
if (index < 0 || index >= str.size())
658-
REPLACE_RET_VALUE("", 2);
659-
else
660-
REPLACE_RET_VALUE(utf8::utf16to8(std::u16string({ str[index] })), 2);
661-
FREE_REGS(1);
656+
{
657+
std::u16string str = READ_REG(0, 2)->toUtf16();
658+
if (index < 0 || index >= str.size())
659+
REPLACE_RET_VALUE("", 2);
660+
else
661+
REPLACE_RET_VALUE(utf8::utf16to8(std::u16string({ str[index] })), 2);
662+
FREE_REGS(1);
663+
}
662664
DISPATCH();
663665
}
664666

0 commit comments

Comments
 (0)