From a2d21508be483bf376e66df3ed243dcb5c554a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Thu, 12 Mar 2026 08:34:02 +0200 Subject: [PATCH] Fix `String::split_` crash on empty string. (cherry picked from commit eb6dedf30f8f571a4eb88889a6de90729906274d) --- core/string/ustring.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index cf614b0914..8db8e859f4 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -1195,6 +1195,9 @@ Vector String::split_floats(const String &p_splitter, bool p_allow_empty Vector ret; int from = 0; int len = length(); + if (len == 0) { + return ret; + } String buffer = *this; while (true) { @@ -1222,6 +1225,9 @@ Vector String::split_floats_mk(const Vector &p_splitters, bool p_ Vector ret; int from = 0; int len = length(); + if (len == 0) { + return ret; + } String buffer = *this; while (true) { @@ -1254,6 +1260,9 @@ Vector String::split_ints(const String &p_splitter, bool p_allow_empty) con Vector 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 String::split_ints_mk(const Vector &p_splitters, bool p_allo Vector ret; int from = 0; int len = length(); + if (len == 0) { + return ret; + } while (true) { int idx = 0;