]> iEval git - fonbot.git/blobdiff - src/ro/ieval/fonbot/Utils.java
Throw NPE when toNonNull gets a null
[fonbot.git] / src / ro / ieval / fonbot / Utils.java
index 5c54f86e89b8ca38cfc5572eca732918fe05db90..ce275fab8c325e224f91b0361252fbec93002df4 100644 (file)
@@ -18,6 +18,8 @@ import android.database.Cursor;
 import android.location.LocationManager;
 import android.media.AudioManager;
 import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
 import android.preference.PreferenceManager;
 import android.provider.ContactsContract.PhoneLookup;
 import android.telephony.SmsManager;
@@ -188,10 +190,8 @@ public final class Utils {
         * @throws AssertionError if the given object is null
         */
        public static <T> T toNonNull(@Nullable T object) throws AssertionError{
-               if(object==null){
-                       Log.wtf(Utils.class.getName(), "toNonNull called with null");
-                       throw new AssertionError("Log.wtf did not terminate the process");
-               }
+               if(object==null)
+                       throw new NullPointerException();
                return object;
        }
 
@@ -299,7 +299,12 @@ public final class Utils {
                        break;
 
                case SMS:
-                       SmsManager.getDefault().sendTextMessage(address.data, null, message, null, null);
+                       new Handler(Looper.getMainLooper()).post(new Runnable(){
+                                       @Override
+                                       public void run(){
+                                               SmsManager.getDefault().sendTextMessage(address.data, null, message, null, null);
+                                       }
+                               });
                        break;
 
                case LOCAL:
This page took 0.022946 seconds and 4 git commands to generate.