Fix String::split_ crash on empty string.

(cherry picked from commit eb6dedf30f8f571a4eb88889a6de90729906274d)
This commit is contained in:
Pāvels Nadtočajevs
2026-03-12 08:34:02 +02:00
committed by Thaddeus Crews
parent 347e610524
commit a2d21508be
+12
View File
@@ -1195,6 +1195,9 @@ Vector<double> String::split_floats(const String &p_splitter, bool p_allow_empty
Vector<double> ret;
int from = 0;
int len = length();
if (len == 0) {
return ret;
}
String buffer = *this;
while (true) {
@@ -1222,6 +1225,9 @@ Vector<float> String::split_floats_mk(const Vector<String> &p_splitters, bool p_
Vector<float> ret;
int from = 0;
int len = length();
if (len == 0) {
return ret;
}
String buffer = *this;
while (true) {
@@ -1254,6 +1260,9 @@ Vector<int> String::split_ints(const String &p_splitter, bool p_allow_empty) con
Vector<int> ret;
int from = 0;
int len = length();
if (len == 0) {
return ret;
}
while (true) {
int end = find(p_splitter, from);
@@ -1278,6 +1287,9 @@ Vector<int> String::split_ints_mk(const Vector<String> &p_splitters, bool p_allo
Vector<int> ret;
int from = 0;
int len = length();
if (len == 0) {
return ret;
}
while (true) {
int idx = 0;