Fix bug#2144742: guard against 0 length encoded string when attaching a 'from' address for MMS.
Change-Id: I0aad5b3d2834695b44cbb63e40c43a2159b723d9
diff --git a/core/java/com/google/android/mms/pdu/PduComposer.java b/core/java/com/google/android/mms/pdu/PduComposer.java
index 8b31936..2aa5e48 100644
--- a/core/java/com/google/android/mms/pdu/PduComposer.java
+++ b/core/java/com/google/android/mms/pdu/PduComposer.java
@@ -19,6 +19,8 @@
import android.content.ContentResolver;
import android.content.Context;
+import android.util.Log;
+import android.text.TextUtils;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
@@ -528,6 +530,7 @@
EncodedStringValue from = mPduHeader.getEncodedStringValue(field);
if ((from == null)
+ || TextUtils.isEmpty(from.getString())
|| new String(from.getTextString()).equals(
PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR)) {
// Length of from = 1