Merge pull request #10536 from osmandapp/fix_crash_oauth_osm

Fix crash OAuth OpenStreetMap
This commit is contained in:
vshcherb 2021-01-06 20:19:57 +01:00 committed by GitHub
commit f1bdb378ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -138,7 +138,11 @@ public class OsmOAuthAuthorizationAdapter {
@Override @Override
protected void onPostExecute(@NonNull OAuth1RequestToken requestToken) { protected void onPostExecute(@NonNull OAuth1RequestToken requestToken) {
loadWebView(rootLayout, nightMode, client.getService().getAuthorizationUrl(requestToken)); if (requestToken != null) {
loadWebView(rootLayout, nightMode, client.getService().getAuthorizationUrl(requestToken));
} else {
app.showShortToastMessage(app.getString(R.string.internet_not_available));
}
} }
} }

View file

@ -45,7 +45,11 @@ public class OsmOAuthHelper {
} }
public void authorize(@NonNull String oauthVerifier) { public void authorize(@NonNull String oauthVerifier) {
authorizationAdapter.authorize(oauthVerifier, this); if (oauthVerifier != null) {
authorizationAdapter.authorize(oauthVerifier, this);
} else {
updateAdapter();
}
} }
public void resetAuthorization() { public void resetAuthorization() {