diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-02 14:43:57 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-02 14:43:57 +0200 |
| commit | a163348561bcdd14feb816e006362639a5862fa9 (patch) | |
| tree | 0cc54bc2f3bc5980fe04fda55a7383a8a85a14f5 | |
| parent | 61fc36d7fb3d147b577c1d25a72e22e45f6c6c83 (diff) | |
feat: check for `arg_val` if not `nullptr`
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
| -rw-r--r-- | src/JSONManifestBuilder.cc | 7 |
1 files changed, 6 insertions, 1 deletions
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; |
