Browse Source

Fix infinite loop in DirAccessPack::get_current_dir()

Pedro J. Estébanez 8 years ago
parent
commit
0469782d3c
1 changed files with 4 additions and 5 deletions
  1. 4 5
      core/io/file_access_pack.cpp

+ 4 - 5
core/io/file_access_pack.cpp

@@ -438,13 +438,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;