summaryrefslogtreecommitdiffstats
path: root/core/string/ustring.cpp
diff options
context:
space:
mode:
authorGeorge L. Albany <Megacake1234@gmail.com>2024-10-27 13:25:03 +0000
committerGitHub <noreply@github.com>2024-10-27 13:25:03 +0000
commit6e3e9dfb9857b751f59fd4b40c55e9262ff5a864 (patch)
treed064b49a4766ab69a0ac6e195868ad4b3443bab3 /core/string/ustring.cpp
parentbec9ffacba1385b0ba808f6dbb66abb7dc53639d (diff)
parent953af98c795066a5a450a3401cc8a4fbc6c12620 (diff)
downloadredot-engine-6e3e9dfb9857b751f59fd4b40c55e9262ff5a864.tar.gz
Merge pull request #814 from Spartan322/merge/61accf0
Merge commit godotengine/godot@61accf0
Diffstat (limited to 'core/string/ustring.cpp')
-rw-r--r--core/string/ustring.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index 127676a9f9..c6ce1ffbcb 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -1852,6 +1852,8 @@ String String::num(double p_num, int p_decimals) {
}
String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
+ ERR_FAIL_COND_V_MSG(base < 2 || base > 36, "", "Cannot convert to base " + itos(base) + ", since the value is " + (base < 2 ? "less than 2." : "greater than 36."));
+
bool sign = p_num < 0;
int64_t n = p_num;
@@ -1890,6 +1892,8 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
}
String String::num_uint64(uint64_t p_num, int base, bool capitalize_hex) {
+ ERR_FAIL_COND_V_MSG(base < 2 || base > 36, "", "Cannot convert to base " + itos(base) + ", since the value is " + (base < 2 ? "less than 2." : "greater than 36."));
+
uint64_t n = p_num;
int chars = 0;