Fix Crash on closed PRs with deleted Fork (#559)

Fix edge-case DeletedFork of a Pull-Branch

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
This commit is contained in:
6543 2020-06-26 17:09:18 +02:00 committed by M M Arif
parent 2483968f11
commit f285d47a0b
2 changed files with 10 additions and 2 deletions

View File

@ -190,8 +190,15 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
prMergeable.setText(String.valueOf(prModel.isMergeable()));
if(prModel.getHead() != null) {
prHeadBranch.setText(prModel.getHead().getRef());
prIsFork.setText(String.valueOf(prModel.getHead().getRepo().isFork()));
prForkFullName.setText(prModel.getHead().getRepo().getFull_name());
if(prModel.getHead().getRepo() != null) {
prIsFork.setText(String.valueOf(prModel.getHead().getRepo().isFork()));
prForkFullName.setText(prModel.getHead().getRepo().getFull_name());
}
else {
// pull was done from a deleted fork
prIsFork.setText("true");
prForkFullName.setText(context.getString(R.string.prDeletedFrok));
}
}
prCommentsCount.setText(String.valueOf(prModel.getComments()));

View File

@ -587,6 +587,7 @@
<string name="unauthorizedApiError">Instance has returned an error - Unauthorized. Check your credentials and try again</string>
<string name="loginTokenError">Please enter the correct token</string>
<string name="prDeletedFrok">Deleted Fork</string>
<string name="noDataPullRequests">No pull requests found</string>
<string name="prCreator">Creator :\u0020</string>
<string name="editPrText">Edit Pull Request</string>