From a163348561bcdd14feb816e006362639a5862fa9 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 2 Jul 2025 14:43:57 +0200 Subject: feat: check for `arg_val` if not `nullptr` Signed-off-by: Amlal El Mahrouss --- src/JSONManifestBuilder.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/JSONManifestBuilder.cc b/src/JSONManifestBuilder.cc index 46a8518..50850f5 100644 --- a/src/JSONManifestBuilder.cc +++ b/src/JSONManifestBuilder.cc @@ -14,11 +14,16 @@ using namespace BTB; /// @brief Builds a JSON target from a JSON file. /// @param arg_sz filename size (must be 1 or greater). /// @param arg_val filename path (must be a valid JSON file). -/// @retval true succeeded building. +/// @retval true building has succeeded. /// @retval false fail to build, see error message. bool JSONManifestBuilder::buildTarget(int arg_sz, const char* arg_val, const bool dry_run) { String path; + if (!arg_val) { + BTB::Logger::info() << "btb: error: file path is empty" << std::endl; + return false; + } + if (arg_sz < 0) { BTB::Logger::info() << "btb: error: file path is empty" << std::endl; return false; -- cgit v1.2.3