mirror of
https://github.com/minetest/minetest.git
synced 2025-04-02 08:22:56 +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:
@ -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++) {
|
||||||
|
Reference in New Issue
Block a user