Add missing nullptr check
Static analysis flags two missing nullptr checks. Add them.
Tested: dbus-rest is a deprecated option, so unit testing is the only
difference there.
Log services notify was added recently. Need help testing, otherwise
inspection only.
Change-Id: If92153ffa9c9fdf8903ce386f025ceebcf7510eb
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 1892213..eb54899 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -1950,6 +1950,11 @@
while (propNode != nullptr)
{
const char* propertyName = propNode->Attribute("name");
+ if (propertyName == nullptr)
+ {
+ BMCWEB_LOG_DEBUG("Couldn't find name property");
+ continue;
+ }
BMCWEB_LOG_DEBUG("Found property {}", propertyName);
if (propertyName == transaction->propertyName)
{
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 7f27515..76a2414 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -1753,11 +1753,14 @@
{
thisEntry["Resolution"] = *resolution;
}
- std::optional<bool> notifyAction =
- getProviderNotifyAction(*notify);
- if (notifyAction)
+ if (notify != nullptr)
{
- thisEntry["ServiceProviderNotified"] = *notifyAction;
+ std::optional<bool> notifyAction =
+ getProviderNotifyAction(*notify);
+ if (notifyAction)
+ {
+ thisEntry["ServiceProviderNotified"] = *notifyAction;
+ }
}
thisEntry["EntryType"] = "Event";
thisEntry["Severity"] =