[3.2] Backport hex_to_int/bin_to_int zero check and C# changes
This commit is contained in:
@ -1670,9 +1670,10 @@ String::String(const StrRange &p_range) {
|
||||
}
|
||||
|
||||
int String::hex_to_int(bool p_with_prefix) const {
|
||||
|
||||
if (p_with_prefix && length() < 3)
|
||||
int len = length();
|
||||
if (len == 0 || (p_with_prefix && len < 3)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const CharType *s = ptr();
|
||||
|
||||
@ -1755,9 +1756,10 @@ int64_t String::hex_to_int64(bool p_with_prefix) const {
|
||||
}
|
||||
|
||||
int64_t String::bin_to_int64(bool p_with_prefix) const {
|
||||
|
||||
if (p_with_prefix && length() < 3)
|
||||
int len = length();
|
||||
if (len == 0 || (p_with_prefix && len < 3)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const CharType *s = ptr();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user