Fix netipmid crash due to RMCP_PING activation

The netipmid service occasionally crashes following the changes
introduced in commit #73192.
https://gerrit.openbmc.org/c/openbmc/phosphor-net-ipmid/+/73192
This commit enabled the RMCP_PING definition, which activated
previously dormant code paths under the RMCP_PING flow.

The crash occurs when the inMessage pointer of the rmcpMsgClass
is dereferenced in the Handler destructor, and inMessage is
NULL. To prevent this crash, this commit adds a check to ensure
inMessage is not NULL before accessing.

Signed-off-by: poram srinivasa rao <poramx.srinivasa.rao@intel.com>
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: Ibb14cff628a690acb72aed8c35aff226cfcdcb41
diff --git a/message_handler.cpp b/message_handler.cpp
index f5c4a1b..b7365bb 100644
--- a/message_handler.cpp
+++ b/message_handler.cpp
@@ -57,7 +57,7 @@
     try
     {
 #ifdef RMCP_PING
-        if (ClassOfMsg::ASF == inMessage->rmcpMsgClass)
+        if (inMessage && (ClassOfMsg::ASF == inMessage->rmcpMsgClass))
         {
             sendASF();
         }
@@ -93,7 +93,7 @@
 
 #ifdef RMCP_PING
     // Execute the Command, possibly asynchronously
-    if (ClassOfMsg::ASF != inMessage->rmcpMsgClass)
+    if (inMessage && (ClassOfMsg::ASF != inMessage->rmcpMsgClass))
 #endif // RMCP_PING
     {
         updSessionData(inMessage);