@@ -67,7 +67,18 @@ protected class ErrorHolder
6767 public void onStatus (EMDKManager .StatusData statusData , EMDKBase emdkBase ) {
6868 if (statusData .getResult () == EMDKResults .STATUS_CODE .SUCCESS )
6969 {
70- onProfileManagerInitialized ((ProfileManager )emdkBase );
70+ ProfileManager profileManager = (ProfileManager )emdkBase ;
71+ if (profileManager != null )
72+ onProfileManagerInitialized (profileManager );
73+ else
74+ {
75+ logMessage ("Casting error when retrieving ProfileManager." , EMessageType .ERROR );
76+ profileManager = (ProfileManager ) mEMDKManager .getInstance (EMDKManager .FEATURE_TYPE .PROFILE );
77+ if (profileManager != null ) {
78+ logMessage ("Profile manager retrieved synchronously with success" , EMessageType .VERBOSE );
79+ onProfileManagerInitialized (profileManager );
80+ }
81+ }
7182 }
7283 else
7384 {
@@ -267,6 +278,30 @@ private void processMXContent()
267278 String [] params = new String [1 ];
268279 params [0 ] = msProfileData ;
269280
281+ if (mProfileManager == null )
282+ {
283+ logMessage ("ProcessMXContent : Error : ProfileManager == null" , EMessageType .ERROR );
284+ if (mEMDKManager != null ) {
285+ logMessage ("ProcessMXContent : Trying to retrieve profileManager synchronously" , EMessageType .ERROR );
286+ ProfileManager profileManager = (ProfileManager ) mEMDKManager .getInstance (EMDKManager .FEATURE_TYPE .PROFILE );
287+ if (profileManager != null ) {
288+ logMessage ("ProcessMXContent, ProfileManager retrieved syncrhonously." ,EMessageType .VERBOSE );
289+ mProfileManager = profileManager ;
290+ }
291+ else
292+ {
293+ logMessage ("ProcessMXContent : Error : Could not retrieve ProfileManager syncrhonously." ,EMessageType .VERBOSE );
294+ onProfileExecutedError ("ProcessMXContent : Error : Could not retrieve ProfileManager syncrhonously." );
295+ return ;
296+ }
297+ }
298+ else {
299+ logMessage ("ProcessMXContent : Error : mEMDKManager == null" , EMessageType .ERROR );
300+ onProfileExecutedError ("ProcessMXContent : Error : mEMDKManager == null" );
301+ return ;
302+ }
303+ }
304+
270305 EMDKResults results = mProfileManager .processProfile (msProfileName , ProfileManager .PROFILE_FLAG .SET , params );
271306
272307 //Check the return status of processProfile
0 commit comments