summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2017-05-04 02:20:53 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2017-05-04 02:20:53 +0200
commit5c0188b5c3f495242d736f7538d3344cec355030 (patch)
tree9c1071df70444d9eb0eb4a7c431a0ec835885ee5 /core/io
parentd730ee66a4664c2142030fe3bfae4847b8990fa8 (diff)
Fix infinite loop in DirAccessPack::get_current_dir()
Diffstat (limited to 'core/io')
-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;