mirror of
https://github.com/minetest/minetest.git
synced 2024-08-19 21:14:15 +02:00
Fix crash if zip file cannot be opened (#14636)
Helped-by: savilli <78875209+savilli@users.noreply.github.com>
This commit is contained in:
parent
a8af0c0ca4
commit
57b6e74abb
@ -71,7 +71,9 @@ local function download_and_extract(param)
|
|||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
if tempfolder == "" then
|
if tempfolder == "" then
|
||||||
return {
|
return {
|
||||||
msg = fgettext_ne("Failed to extract \"$1\" (unsupported file type or broken archive)", package.title),
|
msg = fgettext_ne("Failed to extract \"$1\" " ..
|
||||||
|
"(insufficient disk space, unsupported file type or broken archive)",
|
||||||
|
package.title),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -932,6 +932,8 @@ bool extractZipFile(io::IFileSystem *fs, const char *filename, const std::string
|
|||||||
}
|
}
|
||||||
|
|
||||||
irr_ptr<io::IFileArchive> opened_zip(zip_loader->createArchive(filename, false, false));
|
irr_ptr<io::IFileArchive> opened_zip(zip_loader->createArchive(filename, false, false));
|
||||||
|
if (!opened_zip)
|
||||||
|
return false;
|
||||||
const io::IFileList* files_in_zip = opened_zip->getFileList();
|
const io::IFileList* files_in_zip = opened_zip->getFileList();
|
||||||
|
|
||||||
for (u32 i = 0; i < files_in_zip->getFileCount(); i++) {
|
for (u32 i = 0; i < files_in_zip->getFileCount(); i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user