From e21e8d8c1d5313962d0c41a556ac97a1265742fd Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sun, 17 Aug 2014 08:47:30 +0100 Subject: [PATCH] Fixed API crash when writing a minimal list. If the parent directory doesn't exist, an exception gets thrown without this check. --- src/api/api.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/api/api.cpp b/src/api/api.cpp index 18165927..53e9d96b 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -671,6 +671,9 @@ LOOT_API unsigned int loot_write_minimal_list (loot_db db, const char * const ou if (db == nullptr || outputFile == nullptr) return c_error(loot_error_invalid_args, "Null pointer passed."); + if (!boost::filesystem::exists(boost::filesystem::path(outputFile).parent_path())) + return c_error(loot_error_invalid_args, "Output directory does not exist."); + if (boost::filesystem::exists(outputFile) && !overwrite) return c_error(loot_error_invalid_args, "Output file exists but overwrite is not set to true.");