1
0
mirror of https://codeberg.org/gitnex/GitNex synced 2025-03-08 23:57:44 +01:00

Fix crashes on commits and don't reload (#1142)

Closes #1141

Co-authored-by: qwerty287 <ndev@web.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1142
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
qwerty287 2022-05-19 09:06:11 +02:00 committed by M M Arif
parent c44dcf86c3
commit da571929f0
2 changed files with 12 additions and 3 deletions

View File

@ -61,6 +61,8 @@ public class CommitDetailFragment extends Fragment {
super.onCreateView(inflater, container, savedInstanceState);
if(binding != null) return binding.getRoot();
binding = FragmentCommitDetailsBinding.inflate(getLayoutInflater(), container, false);
RepositoryContext repository = RepositoryContext.fromIntent(requireActivity().getIntent());
@ -125,7 +127,7 @@ public class CommitDetailFragment extends Fragment {
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
checkLoading();
Toasty.error(requireContext(), getString(R.string.genericError));
if(getContext() != null) Toasty.error(requireContext(), getString(R.string.genericError));
}
});
}
@ -229,8 +231,10 @@ public class CommitDetailFragment extends Fragment {
public void onFailure(@NonNull Call<Commit> call, @NonNull Throwable t) {
checkLoading();
Toasty.error(requireContext(), getString(R.string.genericError));
requireActivity().finish();
if(getContext() != null) {
Toasty.error(requireContext(), getString(R.string.genericError));
requireActivity().finish();
}
}
});
}

View File

@ -39,6 +39,11 @@ public class DiffFilesFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if(binding != null) {
ctx = requireContext();
return binding.getRoot();
}
binding = FragmentDiffFilesBinding.inflate(inflater, container, false);
ctx = requireContext();
IssueContext issue = IssueContext.fromIntent(requireActivity().getIntent());