Add missing nullptr checks

These were found by inspection, and should be cases that aren't
possible, but we should be consistent.  Check the pointers for null
before dereferencing.

Tested: Inspection only.  Condition theoretically not possible to hit.

Change-Id: I1423bb5bae5445d2b4b0cee2f3315b3ddd1c3836
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/include/dbus_privileges.hpp b/include/dbus_privileges.hpp
index 65b4042..fca4a13 100644
--- a/include/dbus_privileges.hpp
+++ b/include/dbus_privileges.hpp
@@ -40,6 +40,11 @@
         return false;
     }
 
+    if (req.session == nullptr)
+    {
+        return false;
+    }
+
     if (userRolePtr != nullptr)
     {
         req.session->userRole = *userRolePtr;
@@ -93,6 +98,10 @@
                      const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                      BaseRule& rule)
 {
+    if (req.session == nullptr)
+    {
+        return false;
+    }
     // Get the user's privileges from the role
     redfish::Privileges userPrivileges =
         redfish::getUserPrivileges(*req.session);