Fix null access on configs with no post complete
Fix null access to unitinialized dbus APIs when we
don't provide post complete
Tested: loaded on nvl32-obmc and AC cycled, no dump
Change-Id: Icf88697a7d3a7a1482f15b665521ed07215aba5e
Signed-off-by: Marc Olberding <molberding@nvidia.com>
diff --git a/src/power_control.cpp b/src/power_control.cpp
index ff7f7e9..7391099 100644
--- a/src/power_control.cpp
+++ b/src/power_control.cpp
@@ -249,6 +249,11 @@
};
static void setOperatingSystemState(const OperatingSystemStateStage stage)
{
+ if (!osIface)
+ {
+ return;
+ }
+
operatingSystemState = stage;
#if IGNORE_SOFT_RESETS_DURING_POST
// If POST complete has asserted set ignoreNextSoftReset to false to avoid
@@ -677,6 +682,10 @@
}
static void setRestartCauseProperty(const std::string& cause)
{
+ if (!restartCauseIface)
+ {
+ return;
+ }
lg2::info("RestartCause set to {RESTART_CAUSE}", "RESTART_CAUSE", cause);
restartCauseIface->set_property("RestartCause", cause);
}