diff options
| author | Juan Linietsky | 2014-03-13 23:14:35 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2014-03-13 23:14:35 -0300 |
| commit | 0a717ffee270b3d2761aaae6a42c06d999a5b823 (patch) | |
| tree | a52dd64a8c76e24f4734f917af3a124f4dea6d4b /core/ustring.cpp | |
| parent | 31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b (diff) | |
| parent | 81757d2e977d959e6b0bc26f9fa990417ca91de9 (diff) | |
| download | godot-0a717ffee270b3d2761aaae6a42c06d999a5b823.tar.gz godot-0a717ffee270b3d2761aaae6a42c06d999a5b823.tar.zst godot-0a717ffee270b3d2761aaae6a42c06d999a5b823.zip | |
Merge branch 'master' of https://github.com/okamstudio/godot
Conflicts:
modules/multiscript/register_types.cpp
platform/android/java/src/com/android/godot/GodotLib.java
Diffstat (limited to 'core/ustring.cpp')
| -rw-r--r-- | core/ustring.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index f53829fe2..d119e341c 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -2501,19 +2501,21 @@ bool String::begins_with(const String& p_string) const { const CharType *src=&p_string[0]; const CharType *str=&operator[](0); - for (int i=0;i<l;i++) { + int i = 0; + for (;i<l;i++) { if (src[i]!=str[i]) return false; } - return true; + // only if i == l the p_string matches the beginning + return i == l; } bool String::begins_with(const char* p_string) const { int l=length(); - if (l==0) + if (l==0||!p_string) return false; const CharType *str=&operator[](0); |
