diff options
-rw-r--r-- | redfish-core/include/utils/json_utils.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp index 5f3f098..86bd97c 100644 --- a/redfish-core/include/utils/json_utils.hpp +++ b/redfish-core/include/utils/json_utils.hpp @@ -129,6 +129,11 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key, jsonPtr = &helper; } } + if (jsonPtr == nullptr) + { + messages::propertyValueTypeError(res, jsonValue.dump(), key); + return false; + } if (!checkRange<Type>(*jsonPtr, key, jsonValue, res)) { return false; @@ -141,6 +146,7 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key, int64_t* jsonPtr = jsonValue.get_ptr<int64_t*>(); if (jsonPtr == nullptr) { + messages::propertyValueTypeError(res, jsonValue.dump(), key); return false; } if (!checkRange<Type>(*jsonPtr, key, jsonValue, res)) @@ -156,6 +162,7 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key, uint64_t* jsonPtr = jsonValue.get_ptr<uint64_t*>(); if (jsonPtr == nullptr) { + messages::propertyValueTypeError(res, jsonValue.dump(), key); return false; } if (!checkRange<Type>(*jsonPtr, key, jsonValue, res)) |