File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
app/src/main/java/fr/free/nrw/commons/contributions Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -275,17 +275,25 @@ private void setUploadCount() {
275275 .getUploadCount (sessionManager .getCurrentAccount ().name )
276276 .subscribeOn (Schedulers .io ())
277277 .observeOn (AndroidSchedulers .mainThread ())
278- .subscribe (
279- uploadCount -> getSupportActionBar ().setSubtitle (getResources ()
280- .getQuantityString (R .plurals .contributions_subtitle ,
281- uploadCount , uploadCount )),
278+ .subscribe (this ::displayUploadCount ,
282279 t -> Timber .e (t , "Fetching upload count failed" )
283280 ));
284281 }
285282
286- public void betaSetUploadCount (int betaUploadCount ){
283+ private void displayUploadCount (Integer uploadCount ) {
284+ if (isFinishing ()
285+ || getSupportActionBar () == null
286+ || getResources () == null ) {
287+ return ;
288+ }
289+
287290 getSupportActionBar ().setSubtitle (getResources ()
288- .getQuantityString (R .plurals .contributions_subtitle , betaUploadCount , betaUploadCount ));
291+ .getQuantityString (R .plurals .contributions_subtitle ,
292+ uploadCount , uploadCount ));
293+ }
294+
295+ public void betaSetUploadCount (int betaUploadCount ) {
296+ displayUploadCount (betaUploadCount );
289297 }
290298
291299
You can’t perform that action at this time.
0 commit comments