prevent nullpointer exception on tests
This commit is contained in:
parent
ec62cb6347
commit
793a9e3549
|
@ -64,8 +64,12 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
|
|
||||||
|
String url_prefix = "https://m.";
|
||||||
|
if (main != null){
|
||||||
SharedPreferences shared_prefs = PreferenceManager.getDefaultSharedPreferences(main.get());
|
SharedPreferences shared_prefs = PreferenceManager.getDefaultSharedPreferences(main.get());
|
||||||
String url_prefix = shared_prefs.getString("url_preference", "m.facebook.com");
|
url_prefix = shared_prefs.getString("url_preference", url_prefix);
|
||||||
|
}
|
||||||
|
|
||||||
// rewrite url to m.facebook and dismiss any query strings or referrals
|
// rewrite url to m.facebook and dismiss any query strings or referrals
|
||||||
String ret = url_prefix + matcher.group(1);
|
String ret = url_prefix + matcher.group(1);
|
||||||
if (matcher.group(2) != null) {
|
if (matcher.group(2) != null) {
|
||||||
|
@ -233,6 +237,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
protected void onPostExecute(Void aVoid) {
|
protected void onPostExecute(Void aVoid) {
|
||||||
super.onPostExecute(aVoid);
|
super.onPostExecute(aVoid);
|
||||||
|
|
||||||
|
if (main != null) {
|
||||||
if (this.event != null) {
|
if (this.event != null) {
|
||||||
main.get().update(event);
|
main.get().update(event);
|
||||||
} else {
|
} else {
|
||||||
|
@ -241,4 +246,5 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue