Skip to content

Commit

Permalink
final fix for NullPointerException that affected a huge part of users
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTasche committed Oct 2, 2013
1 parent ef9fdf3 commit 117b8c2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.tomtasche.reader"
android:installLocation="auto"
android:versionCode="50"
android:versionName="2.11.4" >
android:versionCode="51"
android:versionName="2.11.5" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Binary file modified OpenDocument.apk
Binary file not shown.
22 changes: 21 additions & 1 deletion src/at/tomtasche/reader/ui/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.LinearLayout;
Expand Down Expand Up @@ -244,8 +245,11 @@ public void onAdExpanded(AdLayout arg0) {

@Override
public void onAdFailedToLoad(AdLayout arg0, AdError arg1) {
((ViewGroup) madView.getParent()).removeView(madView);
((AdLayout) madView).destroy();

madView = null;

showGoogleAds();
}

Expand Down Expand Up @@ -776,7 +780,23 @@ protected void onDestroy() {
e.printStackTrace();
}

super.onDestroy();
try {
// keeps throwing exceptions for some users:
// Caused by: java.lang.NullPointerException
// android.webkit.WebViewClassic.requestFocus(WebViewClassic.java:9898)
// android.webkit.WebView.requestFocus(WebView.java:2133)
// android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2384)
if (madView != null) {
if (madView instanceof AdView) {
((AdView) madView).destroy();
} else if (madView instanceof AdLayout) {
((AdLayout) madView).destroy();
}
}
super.onDestroy();
} catch (Exception e) {
e.printStackTrace();
}
}

public String getPublicKey() {
Expand Down

0 comments on commit 117b8c2

Please sign in to comment.