File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -105,15 +105,16 @@ public void handleResponse( Integer response )
105105 Log .d ( TAG , "Unregistered on Backendless." );
106106 if ( response < 1 )
107107 FCMRegistration .unregisterDeviceOnFCM ( appContext , callback );
108- else
108+ else if ( callback != null )
109109 callback .handleResponse ( response );
110110 }
111111
112112 @ Override
113113 public void handleFault ( BackendlessFault fault )
114114 {
115115 Log .d ( TAG , "Could not unregister device on Backendless server: " + fault .toString () );
116- callback .handleFault ( new BackendlessFault ( "Could not unregister device on Backendless server: " + fault .toString () ) );
116+ if (callback != null )
117+ callback .handleFault ( new BackendlessFault ( "Could not unregister device on Backendless server: " + fault .toString () ) );
117118 }
118119 } );
119120 }
@@ -128,13 +129,15 @@ public void onComplete( @NonNull Task<Void> task )
128129 if ( task .isSuccessful () )
129130 {
130131 Log .d ( TAG , "Unsubscribed on FCM." );
131- callback .handleResponse ( 0 );
132+ if ( callback != null )
133+ callback .handleResponse ( 0 );
132134 }
133135 else
134136 {
135137 Log .e ( TAG , "Failed to unsubscribe in FCM." , task .getException () );
136138 String reason = (task .getException () != null ) ? Objects .toString ( task .getException ().getMessage () ) : "" ;
137- callback .handleFault ( new BackendlessFault ( "Failed to unsubscribe on FCM. " + reason ) );
139+ if ( callback != null )
140+ callback .handleFault ( new BackendlessFault ( "Failed to unsubscribe on FCM. " + reason ) );
138141 }
139142 }
140143 } );
You can’t perform that action at this time.
0 commit comments