Try to fix crash when zip_open_from_source returns an error.
authorCarl Hetherington <cth@carlh.net>
Sun, 14 Oct 2018 00:28:14 +0000 (01:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 14 Oct 2018 00:28:14 +0000 (01:28 +0100)
src/lib/internet.cc

index 662a82443623ed256af0394c75dbfa6b8a505972..d6fb02a17cf8f7e7002cb83123aa916ea1a0c13a 100644 (file)
@@ -119,9 +119,10 @@ get_from_zip_url (string url, string file, bool pasv, function<void (boost::file
                return optional<string> (_("Could not open downloaded ZIP file"));
        }
 
-       zip_t* zip = zip_open_from_source (zip_source, 0, 0);
+       zip_error_t error;
+       zip_t* zip = zip_open_from_source (zip_source, ZIP_RDONLY, &error);
        if (!zip) {
-               return optional<string> (_("Could not open downloaded ZIP file"));
+               return String::compose (_("Could not open downloaded ZIP file (%1)"), error.str ? error.str : "");
        }
 
 #else