Skip to content

Commit 824d6ac

Browse files
ashishkumar468maskaravivek
authored andcommitted
Bugfix/null revision in review (commons-app#3309)
* Fixes commons-app#3305 * Handle null firstRevision * initialise explanation
1 parent 959b3af commit 824d6ac

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/src/main/java/fr/free/nrw/commons/review/ReviewImageFragment.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
7676
false);
7777
ButterKnife.bind(this, layoutView);
7878

79-
String question, explanation, yesButtonText, noButtonText;
79+
String question, explanation=null, yesButtonText, noButtonText;
8080
switch (position) {
8181
case SPAM:
8282
question = getString(R.string.review_spam);
@@ -115,12 +115,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
115115

116116
//Get existing user name if it is already saved using savedInstanceState else get from reviewController
117117
if (savedInstanceState == null) {
118-
user = getReviewActivity().reviewController.firstRevision.getUser();
118+
if (getReviewActivity().reviewController != null) {
119+
user = getReviewActivity().reviewController.firstRevision.getUser();
120+
}
119121
} else {
120122
user = savedInstanceState.getString(SAVED_USER);
121123
}
122124

123-
explanation = getString(R.string.review_thanks_explanation, user);
125+
//if the user is null because of whatsoever reason, review will not be sent anyways
126+
if (!TextUtils.isEmpty(user)) {
127+
explanation = getString(R.string.review_thanks_explanation, user);
128+
}
124129

125130
yesButtonText = getString(R.string.review_thanks_yes_button_text);
126131
noButtonText = getString(R.string.review_thanks_no_button_text);

0 commit comments

Comments
 (0)