diff --git a/services/context/src/widget_client.cpp b/services/context/src/widget_client.cpp index 2a7431463e9734824ab20ba7c383b8bc722b0df2..dbb31f2fce3f69e367263d44dcca31248c376dbb 100644 --- a/services/context/src/widget_client.cpp +++ b/services/context/src/widget_client.cpp @@ -68,8 +68,8 @@ ResultCode WidgetClient::OnNotice(NoticeType type, const std::string &eventData) } IAM_LOGI("recv notice eventData: %{public}s", eventData.c_str()); auto root = nlohmann::json::parse(eventData.c_str(), nullptr, false); - if (root.is_null() || root.is_discarded()) { - IAM_LOGE("OnNotice eventData is not json format"); + if (root.is_null() || root.is_discarded() || !root.is_object()) { + IAM_LOGE("OnNotice eventData is not correct json format"); return ResultCode::INVALID_PARAMETERS; } WidgetNotice notice = root.get();