fix %0$s error
This commit is contained in:
parent
1174c9d163
commit
e616214c72
1 changed files with 3 additions and 3 deletions
|
@ -238,7 +238,7 @@ function parseMinecraftMessage(component) {
|
|||
translateString = translateString.replace(/%(\d+)\$s/g, (match, index, stringindex, string) => {
|
||||
const argIndex = parseInt(index) - 1;
|
||||
|
||||
if (argIndex >= withArgs.length) {
|
||||
if (argIndex < 0 || argIndex >= withArgs.length) {
|
||||
DefaultMsg = true;
|
||||
return match;
|
||||
}
|
||||
|
@ -322,11 +322,11 @@ function parseMinecraftMessageNoColor(component) {
|
|||
translateString = translateString.replace(/%(\d+)\$s/g, (match, index, stringindex, string) => {
|
||||
const argIndex = parseInt(index) - 1;
|
||||
|
||||
if (argIndex >= withArgs.length) {
|
||||
if (argIndex < 0 || argIndex >= withArgs.length) {
|
||||
DefaultMsg = true;
|
||||
return match;
|
||||
}
|
||||
|
||||
|
||||
if (stringindex > 0 && string[stringindex - 1] === '%') {
|
||||
return match;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue