You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
godot-cpp String::split() incorrectly casting godot_array to PoolStringArray? #144
Trying to use String.split() from C++ GDNative resulted in crashes when trying to access the values, and bogus size() values.
It looks like godot-cpp/src/core/String.cpp is directly casting a godot_array into a PoolStringArray, which AFAICS are distinct types - shouldn't it be doing something more like this (which does appear to do the right thing for me)?
String s("Hello World! This string was split");
PoolStringArray p = s.split("");
Godot::print(String("String was split in ") + String::num_int64(p.size()));
PoolStringArray::Read r = p.read();
for (int i = 0; i < p.size(); ++i) {
Godot::print(r[i]);
}
Result:
String was split in 6
Hello
World!
This
string
was
split
Activity
paulmenage commentedon Jun 14, 2018
And the same issue for String::split_floats()
karroffel commentedon Jun 15, 2018
Oh yes, that's an error, I'll see if I can fix it today
BastiaanOlij commentedon Nov 23, 2018
@karroffel this code has changed a bit since June, looks like this was fixed?
Zylann commentedon Jan 7, 2021
Just tested this after PR #490
Result:
No errors, no crashes.