From 7f3ece1bf8e5f09c677263663292d408b380dc74 Mon Sep 17 00:00:00 2001 From: edwoodward Date: Fri, 6 Jan 2017 12:20:37 -0600 Subject: [PATCH] Fixed nullpointer in onPause --- app/build.gradle | 6 +++--- .../org/cnx/android/activity/WebViewActivity.java | 12 ++++++++++-- app/src/main/res/drawable/button_background.xml | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 916588f..54b1930 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,15 +3,15 @@ apply plugin: 'com.android.application' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion '25.0.0' project.archivesBaseName = "CNXAndroid"; defaultConfig { applicationId "org.cnx.android" minSdkVersion 19 targetSdkVersion 23 - versionCode 35 - versionName "6.0" + versionCode 36 + versionName "6.1" } dependencies{ compile 'com.android.support:appcompat-v7:23.4.0' diff --git a/app/src/main/java/org/cnx/android/activity/WebViewActivity.java b/app/src/main/java/org/cnx/android/activity/WebViewActivity.java index 05f0251..903a158 100755 --- a/app/src/main/java/org/cnx/android/activity/WebViewActivity.java +++ b/app/src/main/java/org/cnx/android/activity/WebViewActivity.java @@ -310,10 +310,18 @@ protected void onPause() SharedPreferences sharedPref = getSharedPreferences(getString(R.string.cnx_package), MODE_PRIVATE); SharedPreferences.Editor ed = sharedPref.edit(); WebviewLogic wl = new WebviewLogic(); - String bookURL = wl.getBookURL(content.getUrl().toString()); + String bookURL = wl.getBookURL(content.getUrl()); //Log.d("onPause", "BookURL - " + bookURL); //Log.d("WVA.onPause()","URL saved: " + content.getUrl().toString()); - String url = webView.getUrl().replace("?bookmark=1", ""); + String url; + if(webView.getUrl() != null) + { + url = webView.getUrl().replace("?bookmark=1", ""); + } + else + { + url = content.getUrl(); + } ed.putString(bookURL, url); ed.apply(); } diff --git a/app/src/main/res/drawable/button_background.xml b/app/src/main/res/drawable/button_background.xml index 46bd26f..b39a7ad 100755 --- a/app/src/main/res/drawable/button_background.xml +++ b/app/src/main/res/drawable/button_background.xml @@ -2,7 +2,7 @@ -