diff options
| author | Rémi Verschelde | 2018-05-02 10:36:25 +0200 |
|---|---|---|
| committer | GitHub | 2018-05-02 10:36:25 +0200 |
| commit | f86a67c4d1283526839ce64c8d10e531c8a8adc8 (patch) | |
| tree | f648cdd709023c5e6114bbb4840b0b39faaf5a90 /core/ustring.cpp | |
| parent | b0cf3628aa339504f0b069274cf64f6fe06bdf88 (diff) | |
| parent | a35c8bbdc7bdf2cd5ca640b572dd4ad1e170c260 (diff) | |
| download | godot-f86a67c4d1283526839ce64c8d10e531c8a8adc8.tar.gz godot-f86a67c4d1283526839ce64c8d10e531c8a8adc8.tar.zst godot-f86a67c4d1283526839ce64c8d10e531c8a8adc8.zip | |
Merge pull request #18520 from paulloz/gdscript-api-string-path
fix API string path
Diffstat (limited to 'core/ustring.cpp')
| -rw-r--r-- | core/ustring.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index b98e20217..921d20a6f 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3755,8 +3755,8 @@ String String::get_file() const { String String::get_extension() const { int pos = find_last("."); - if (pos < 0) - return *this; + if (pos < 0 || pos < MAX(find_last("/"), find_last("\\"))) + return ""; return substr(pos + 1, length()); } @@ -3834,7 +3834,7 @@ String String::percent_decode() const { String String::get_basename() const { int pos = find_last("."); - if (pos < 0) + if (pos < 0 || pos < MAX(find_last("/"), find_last("\\"))) return *this; return substr(0, pos); |
