Commit 0e8ca449 authored by Max Kellermann's avatar Max Kellermann

archive/List: disallow passing suffix==nullptr to archive_plugin_from_suffix()

parent 12e75a52
......@@ -26,6 +26,7 @@
#include "plugins/ZzipArchivePlugin.hxx"
#include "util/Macros.hxx"
#include <assert.h>
#include <string.h>
const ArchivePlugin *const archive_plugins[] = {
......@@ -51,8 +52,7 @@ static bool archive_plugins_enabled[ARRAY_SIZE(archive_plugins) - 1];
const ArchivePlugin *
archive_plugin_from_suffix(const char *suffix) noexcept
{
if (suffix == nullptr)
return nullptr;
assert(suffix != nullptr);
archive_plugins_for_each_enabled(plugin)
if (plugin->suffixes != nullptr &&
......
......@@ -58,6 +58,8 @@ OpenArchiveInputStream(Path path, Mutex &mutex)
}
const char *suffix = Path::FromFS(archive).GetSuffix();
if (suffix == nullptr)
return nullptr;
//check which archive plugin to use (by ext)
arplug = archive_plugin_from_suffix(suffix);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment