From 17ae9d3b118ac25cd13586ea338b6b3e84107fc6 Mon Sep 17 00:00:00 2001 From: wangpggg Date: Fri, 14 Jul 2023 14:47:08 +0800 Subject: [PATCH] add the empty judgment for realpath Signed-off-by: wangpeng --- interfaces/kits/js/file_uri/get_uri_from_path.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/js/file_uri/get_uri_from_path.cpp b/interfaces/kits/js/file_uri/get_uri_from_path.cpp index ea23b1118..0c84d6558 100644 --- a/interfaces/kits/js/file_uri/get_uri_from_path.cpp +++ b/interfaces/kits/js/file_uri/get_uri_from_path.cpp @@ -96,7 +96,7 @@ napi_value GetUriFromPath::Sync(napi_env env, napi_callback_info info) } string realPath = path.get(); - if (!NormalizePath(realPath)) { + if (!realPath.empty() && !NormalizePath(realPath)) { LOGE("GetUriFromPath::NormalizePath failed!"); NError(EINVAL).ThrowErr(env); return nullptr; -- Gitee