archive/List: disallow passing suffix==nullptr to archive_plugin_from_suffix()
This commit is contained in:
parent
12e75a523a
commit
0e8ca44968
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user