@@ -188,52 +188,57 @@ protected void checkLifecycleConfiguration() {
188188
189189 if ((actualLanguage != null && !actualLanguage .equals (language )) || (actualHMILanguage != null && !actualHMILanguage .equals (hmiLanguage ))) {
190190
191- final LifecycleConfigurationUpdate lcu = managerListener .managerShouldUpdateLifecycle (actualLanguage , actualHMILanguage );
192-
193- ChangeRegistration changeRegistration ;
194- changeRegistration = new ChangeRegistration (actualLanguage , actualHMILanguage );
195-
196- if (lcu != null ) {
197- changeRegistration .setAppName (lcu .getAppName ());
198- changeRegistration .setNgnMediaScreenAppName (lcu .getShortAppName ());
199- changeRegistration .setTtsName (lcu .getTtsName ());
200- changeRegistration .setVrSynonyms (lcu .getVoiceRecognitionCommandNames ());
201- changeRegistration .setOnRPCResponseListener (new OnRPCResponseListener () {
202- @ Override
203- public void onResponse (int correlationId , RPCResponse response ) {
204- if (response .getSuccess ()) {
205- try {
206- DebugTool .logInfo (TAG , response .serializeJSON ().toString ());
207- } catch (JSONException e ) {
208- DebugTool .logError (TAG , "Error attempting to serialize ChangeRegistrationResponse" , e );
209- }
210-
211- // go through and change sdlManager properties that were changed via the LCU update
212- hmiLanguage = actualHMILanguage ;
213- language = actualLanguage ;
214-
215- if (lcu .getAppName () != null ) {
216- appName = lcu .getAppName ();
217- }
218-
219- if (lcu .getShortAppName () != null ) {
220- shortAppName = lcu .getShortAppName ();
191+ if (managerListener != null ) {
192+ final LifecycleConfigurationUpdate lcu = managerListener .managerShouldUpdateLifecycle (actualLanguage , actualHMILanguage );
193+
194+ ChangeRegistration changeRegistration ;
195+ changeRegistration = new ChangeRegistration (actualLanguage , actualHMILanguage );
196+
197+ if (lcu != null ) {
198+ changeRegistration .setAppName (lcu .getAppName ());
199+ changeRegistration .setNgnMediaScreenAppName (lcu .getShortAppName ());
200+ changeRegistration .setTtsName (lcu .getTtsName ());
201+ changeRegistration .setVrSynonyms (lcu .getVoiceRecognitionCommandNames ());
202+ changeRegistration .setOnRPCResponseListener (new OnRPCResponseListener () {
203+ @ Override
204+ public void onResponse (int correlationId , RPCResponse response ) {
205+ if (response .getSuccess ()) {
206+ try {
207+ DebugTool .logInfo (TAG , response .serializeJSON ().toString ());
208+ } catch (JSONException e ) {
209+ DebugTool .logError (TAG , "Error attempting to serialize ChangeRegistrationResponse" , e );
210+ }
211+
212+ // go through and change sdlManager properties that were changed via the LCU update
213+ hmiLanguage = actualHMILanguage ;
214+ language = actualLanguage ;
215+
216+ if (lcu .getAppName () != null ) {
217+ appName = lcu .getAppName ();
218+ }
219+
220+ if (lcu .getShortAppName () != null ) {
221+ shortAppName = lcu .getShortAppName ();
222+ }
223+
224+ if (lcu .getTtsName () != null ) {
225+ ttsChunks = lcu .getTtsName ();
226+ }
227+
228+ if (lcu .getVoiceRecognitionCommandNames () != null ) {
229+ vrSynonyms = lcu .getVoiceRecognitionCommandNames ();
230+ }
231+ } else {
232+ DebugTool .logError (TAG , "Change Registration onError: " + response .getResultCode () + " | Info: " + response .getInfo ());
233+ retryChangeRegistration ();
221234 }
222-
223- if (lcu .getTtsName () != null ) {
224- ttsChunks = lcu .getTtsName ();
225- }
226-
227- if (lcu .getVoiceRecognitionCommandNames () != null ) {
228- vrSynonyms = lcu .getVoiceRecognitionCommandNames ();
229- }
230- } else {
231- DebugTool .logError (TAG , "Change Registration onError: " + response .getResultCode () + " | Info: " + response .getInfo ());
232- retryChangeRegistration ();
233235 }
234- }
235- });
236- this .sendRPC (changeRegistration );
236+ });
237+ this .sendRPC (changeRegistration );
238+ }
239+ }
240+ else {
241+ DebugTool .logError (TAG , "SdlManagerListener is null" );
237242 }
238243 }
239244 }
0 commit comments