diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-12-18 20:44:19 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-12-18 20:44:19 +0100 |
commit | 2a30f0460d397cbca3e8b07bf8a88ed6548e6166 (patch) | |
tree | ab22ca48c4626d2e5765ca17ce9c09d282403b35 /editor | |
parent | 55e2ff6b2e8d65ff9eb6640068e4f642d11372a5 (diff) |
Prevent infinite loop in export template manager
Diffstat (limited to 'editor')
-rw-r--r-- | editor/export_template_manager.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 3f3362e22f..5a0490701b 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -273,7 +273,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ char fname[16384]; unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0); - String file = fname; + String file = fname.get_file(); Vector<uint8_t> data; data.resize(info.uncompressed_size); @@ -283,21 +283,18 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ unzReadCurrentFile(pkg, data.ptrw(), data.size()); unzCloseCurrentFile(pkg); - print_line(fname); - /* - for(int i=0;i<512;i++) { - print_line(itos(data[i])); - } - */ - - file = file.get_file(); if (p) { p->step(TTR("Importing:") + " " + file, fc); } FileAccess *f = FileAccess::open(template_path.plus_file(file), FileAccess::WRITE); - ERR_CONTINUE(!f); + if (!f) { + ret = unzGoToNextFile(pkg); + fc++; + ERR_CONTINUE(!f); + } + f->store_buffer(data.ptr(), data.size()); memdelete(f); |