summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-05-05 23:02:07 +0200
committerGitHub <noreply@github.com>2017-05-05 23:02:07 +0200
commite58519eb31f0f8af504c27c024dd7265658df147 (patch)
tree4d5a48ab1eb528d555061a286c8d337afd0e8875
parent120ce92e3258b4e3045b1b295e85a2da6cd1528e (diff)
parent5c0188b5c3f495242d736f7538d3344cec355030 (diff)
Merge pull request #8642 from RandomShaper/fix-pack-get-curr-dir
Fix infinite loop in DirAccessPack::get_current_dir()
-rw-r--r--core/io/file_access_pack.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index bb942b54d7..79aa39521f 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -440,13 +440,12 @@ Error DirAccessPack::change_dir(String p_dir) {
String DirAccessPack::get_current_dir() {
- String p;
PackedData::PackedDir *pd = current;
- while (pd->parent) {
+ String p = current->name;
- if (pd != current)
- p = "/" + p;
- p = p + pd->name;
+ while (pd->parent) {
+ pd = pd->parent;
+ p = pd->name + "/" + p;
}
return "res://" + p;