redfish session: Handle generateUserSession errors

generateUserSession returns a null pointer when it fails.  Check for
that failure and return an error to the user, to avoid a null pointer
dereference.

Tested: Nope
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I56144483d542555051acc02655558854205f39a6
diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp
index e4eae68..af01e05 100644
--- a/redfish-core/lib/redfish_sessions.hpp
+++ b/redfish-core/lib/redfish_sessions.hpp
@@ -215,6 +215,12 @@
         persistent_data::SessionStore::getInstance().generateUserSession(
             username, req.ipAddress, clientId,
             persistent_data::PersistenceType::TIMEOUT, isConfigureSelfOnly);
+    if (session == nullptr)
+    {
+        messages::internalError(asyncResp->res);
+        return;
+    }
+
     asyncResp->res.addHeader("X-Auth-Token", session->sessionToken);
     asyncResp->res.addHeader(
         "Location", "/redfish/v1/SessionService/Sessions/" + session->uniqueId);