Fix a possible null pointer dereference

- This commit would fix a possible null pointer
  dereference.

Tested By:
- Code compiles & no functional changes

Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: Idfb52607869ecc42756cffa68617caecfdef9cd3
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 06c6bf2..5b06b37 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -123,13 +123,13 @@
                                     const std::string& newUser,
                                     const std::string& username)
 {
-    const char* errorMessage = e->name;
     if (e == nullptr)
     {
         messages::internalError(asyncResp->res);
         return;
     }
 
+    const char* errorMessage = e->name;
     if (strcmp(errorMessage,
                "xyz.openbmc_project.User.Common.Error.UserNameExists") == 0)
     {