Skip to content

Commit

Permalink
Fixed nullpointer exception in webview loader
Browse files Browse the repository at this point in the history
  • Loading branch information
danieloeh committed Nov 28, 2012
1 parent 35e65ef commit 3692119
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,21 @@ protected Void doInBackground(Void... params) {
} else {
data = StringEscapeUtils.unescapeHtml4(contentEncodedRef);
}

TypedArray res = getActivity().getTheme()
.obtainStyledAttributes(
new int[] { android.R.attr.textColorPrimary });
int colorResource = res.getColor(0, 0);
String colorString = String.format("#%06X",
0xFFFFFF & colorResource);
Log.i(TAG, "text color: " + colorString);
res.recycle();
data = getWebViewStyle(colorString) + data;
Activity activity = getActivity();
if (activity != null) {
TypedArray res = getActivity()
.getTheme()
.obtainStyledAttributes(
new int[] { android.R.attr.textColorPrimary });
int colorResource = res.getColor(0, 0);
String colorString = String.format("#%06X",
0xFFFFFF & colorResource);
Log.i(TAG, "text color: " + colorString);
res.recycle();
data = getWebViewStyle(colorString) + data;
} else {
cancel(true);
}
return null;
}

Expand Down

0 comments on commit 3692119

Please sign in to comment.