Skip to content

Commit

Permalink
fix NPE
Browse files Browse the repository at this point in the history
Conflicts:

	src/de/ub0r/android/smsdroid/MessageListActivity.java
  • Loading branch information
felixb committed May 6, 2012
1 parent f23961c commit d585504
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
36 changes: 19 additions & 17 deletions src/de/ub0r/android/smsdroid/Ads.java
Expand Up @@ -132,26 +132,28 @@ public void onCreate() {
@Override @Override
public void run() { public void run() {


Log.i(TAG, "Refresh Thread started"); Log.d(TAG, "Refresh Thread started");
Looper.prepare(); Looper.prepare();
Ads.this.refreshLooper = Looper.myLooper(); Ads.this.refreshLooper = Looper.myLooper();
Ads.this.refreshHandler = new Handler(Ads.this.refreshLooper) { if (Ads.this.refreshLooper != null) {

Ads.this.refreshHandler = new Handler(Ads.this.refreshLooper) {
@Override
public void handleMessage(final Message msg) { @Override
switch (msg.what) { public void handleMessage(final Message msg) {
case REFRESH_AD: switch (msg.what) {
Log.i(TAG, "Refresh Ad message received. Requesting ad from MobFox"); case REFRESH_AD:
Ads.this.mMobFoxView.loadNextAd(); Log.d(TAG, "Refresh Ad message received. Requesting ad from MobFox");
break; Ads.this.mMobFoxView.loadNextAd();
default: break;
Log.w(TAG, "unknown msg.what: " + msg.what); default:
break; Log.w(TAG, "unknown msg.what: " + msg.what);
break;
}
} }
} };
}; Looper.loop();
Looper.loop(); Log.d(TAG, "Refresh Thread stopped");
Log.i(TAG, "Refresh Thread stopped"); }
} }
}; };
refreshThread.start(); refreshThread.start();
Expand Down
8 changes: 7 additions & 1 deletion src/de/ub0r/android/smsdroid/MessageListActivity.java
Expand Up @@ -540,7 +540,13 @@ public void onClick(final DialogInterface dialog, final int which) {
final Uri u = MessageListActivity.this.conv.getContact().getUri(); final Uri u = MessageListActivity.this.conv.getContact().getUri();
i = new Intent(Intent.ACTION_VIEW, u); i = new Intent(Intent.ACTION_VIEW, u);
} }
MessageListActivity.this.startActivity(i); try {
MessageListActivity.this.startActivity(i);
} catch (ActivityNotFoundException e) {
Log.e(TAG, "activity not found: " + i.getAction(), e);
Toast.makeText(MessageListActivity.this, "activity not found",
Toast.LENGTH_LONG).show();
}
break; break;
case WHICH_CALL: case WHICH_CALL:
MessageListActivity.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri MessageListActivity.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri
Expand Down
4 changes: 3 additions & 1 deletion src/de/ub0r/android/smsdroid/MobilePhoneAdapter.java
Expand Up @@ -133,7 +133,9 @@ public static String cleanRecipient(final String recipient) {
return ""; return "";
} }
String n; String n;
if (recipient.indexOf("<") < recipient.indexOf(">")) { int i = recipient.indexOf("<");
int j = recipient.indexOf(">");
if (i != -1 && i < j) {
n = recipient.substring(recipient.indexOf("<"), recipient.indexOf(">")); n = recipient.substring(recipient.indexOf("<"), recipient.indexOf(">"));
} else { } else {
n = recipient; n = recipient;
Expand Down

0 comments on commit d585504

Please sign in to comment.