summaryrefslogtreecommitdiffstats
path: root/core/ustring.cpp
diff options
context:
space:
mode:
authorPaul Joannon <hello@pauljoannon.com>2018-01-11 12:59:31 +0100
committerPaul Joannon <hello@pauljoannon.com>2018-04-30 09:38:18 +0200
commita35c8bbdc7bdf2cd5ca640b572dd4ad1e170c260 (patch)
tree50ba7c18fe7975926c36c0fc08219ef38ad2423d /core/ustring.cpp
parent6244b9e2e1a7e675452fd574b5007dd25ec73c69 (diff)
downloadredot-engine-a35c8bbdc7bdf2cd5ca640b572dd4ad1e170c260.tar.gz
fix API string path
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index b98e202175..921d20a6fd 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);