this code is giving me a null pointer please help me fix it.
private void homeFragment(Profile profile) {
if (profile != null) {
Bundle mBundle = new Bundle();
mBundle.putParcelable(PARCEL_KEY, profile);
HomeFragment hf = new HomeFragment();
hf.setArguments(mBundle);
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager
.beginTransaction();
fragmentTransaction.replace(R.id.mainContainer, new HomeFragment());
fragmentTransaction.commit();
}
}