mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixes #426: Crash fix caused by NPE
This commit is contained in:
parent
46f081d652
commit
6cecaf9e8c
2 changed files with 10 additions and 3 deletions
|
|
@ -312,4 +312,8 @@ public class Utils {
|
|||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
public static boolean isNullOrWhiteSpace(String value) {
|
||||
return value == null || value.trim().isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,13 +49,16 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
String authCookie;
|
||||
try {
|
||||
authCookie = AccountManager.get(getContext()).blockingGetAuthToken(account, "", false);
|
||||
} catch (OperationCanceledException e) {
|
||||
} catch (OperationCanceledException | AuthenticatorException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
Log.d("Commons", "Could not authenticate :(");
|
||||
return;
|
||||
} catch (AuthenticatorException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if(Utils.isNullOrWhiteSpace(authCookie)) {
|
||||
Log.d("Commons", "Could not authenticate :(");
|
||||
return;
|
||||
}
|
||||
|
||||
MWApi api = CommonsApplication.createMWApi();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue