Fix segmentation fault when deleting the sessions

Fix the segmentation fault caused by deleting the sessions via Redfish.
Do not compare the username when deleting the sessions with no-auth.

Tested: Delete the session via Redfish and bmcweb not crashed

Signed-off-by: wukaihua-fii-na <eason.kh.wu@fii-na.com>
Change-Id: I7f5268e7243a22ba5010ba5b8b4c82f19b8b4f20
diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp
index 58499a5..89008c9 100644
--- a/redfish-core/lib/redfish_sessions.hpp
+++ b/redfish-core/lib/redfish_sessions.hpp
@@ -89,7 +89,8 @@
     // then the ConfigureSelf privilege does not apply.  In that
     // case, perform the authority check again without the user's
     // ConfigureSelf privilege.
-    if (session->username != req.session->username)
+    if (req.session != nullptr && !session->username.empty() &&
+        session->username != req.session->username)
     {
         Privileges effectiveUserPrivileges =
             redfish::getUserPrivileges(req.userRole);