From 8d930b508a7c84004aced50dc6009f9d38696eee Mon Sep 17 00:00:00 2001 From: Skalii Date: Wed, 6 Jan 2021 18:23:59 +0200 Subject: [PATCH] fix crash auth without internet connection; fix other crash; --- .../plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java | 6 +++++- .../src/net/osmand/plus/osmedit/oauth/OsmOAuthHelper.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java b/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java index d1c9f36e9a..abc5d1f407 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java @@ -138,7 +138,11 @@ public class OsmOAuthAuthorizationAdapter { @Override 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)); + } } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthHelper.java b/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthHelper.java index 8db1079b8b..0eed60b924 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthHelper.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthHelper.java @@ -45,7 +45,11 @@ public class OsmOAuthHelper { } public void authorize(@NonNull String oauthVerifier) { - authorizationAdapter.authorize(oauthVerifier, this); + if (oauthVerifier != null) { + authorizationAdapter.authorize(oauthVerifier, this); + } else { + updateAdapter(); + } } public void resetAuthorization() {