Browse Source

Fix a crash when starting call

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 years ago
parent
commit
7622ffc090

+ 10 - 8
app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java

@@ -556,14 +556,16 @@ public class ContactsController extends BaseController implements SearchView.OnQ
 
                             @Override
                             public void onNext(RoomOverall roomOverall) {
-                                overridePushHandler(new NoOpControllerChangeHandler());
-                                overridePopHandler(new NoOpControllerChangeHandler());
-                                Intent callIntent = new Intent(getActivity(), CallActivity.class);
-                                Bundle bundle = new Bundle();
-                                bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
-                                bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
-                                callIntent.putExtras(bundle);
-                                startActivity(callIntent);
+                                if (getActivity() != null) {
+                                    overridePushHandler(new NoOpControllerChangeHandler());
+                                    overridePopHandler(new NoOpControllerChangeHandler());
+                                    Intent callIntent = new Intent(getActivity(), CallActivity.class);
+                                    Bundle bundle = new Bundle();
+                                    bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
+                                    bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
+                                    callIntent.putExtras(bundle);
+                                    startActivity(callIntent);
+                                }
                             }
 
                             @Override