mirror of https://github.com/arendst/Tasmota.git
Merge pull request #14188 from s-hadinger/berry_string_format
Berry fix string.format crash
This commit is contained in:
commit
89e3851903
|
@ -578,7 +578,7 @@ static int str_format(bvm *vm)
|
|||
break;
|
||||
case 's': {
|
||||
const char *s = be_tostring(vm, index);
|
||||
int len = be_strlen(vm, 2);
|
||||
int len = be_strlen(vm, index);
|
||||
if (len > 100 && strlen(mode) == 2) {
|
||||
be_pushvalue(vm, index);
|
||||
} else {
|
||||
|
|
|
@ -39,3 +39,44 @@ s="azerty"
|
|||
assert(s[1..2] == "ze")
|
||||
assert(s[1..] == "zerty")
|
||||
assert(s[1..-1] == "zerty")
|
||||
|
||||
#- string ranges -#
|
||||
s="azertyuiop"
|
||||
assert(s[0] == "a")
|
||||
assert(s[0..1] == "az")
|
||||
assert(s[0..2] == "aze")
|
||||
assert(s[0..10] == s)
|
||||