Fix failed SMIL generation when part name is null

Fixes #2851
Closes #2866

// FREEBIE
This commit is contained in:
Jake McGinty 2015-04-02 11:07:47 -07:00 committed by Moxie Marlinspike
parent db7a657001
commit 5cb94f02b3

View File

@ -5,8 +5,6 @@ import android.util.Log;
import org.thoughtcrime.securesms.dom.smil.SmilDocumentImpl; import org.thoughtcrime.securesms.dom.smil.SmilDocumentImpl;
import org.thoughtcrime.securesms.dom.smil.parser.SmilXmlSerializer; import org.thoughtcrime.securesms.dom.smil.parser.SmilXmlSerializer;
import org.thoughtcrime.securesms.mms.PartParser; import org.thoughtcrime.securesms.mms.PartParser;
import org.thoughtcrime.securesms.mms.Slide;
import org.thoughtcrime.securesms.mms.SlideDeck;
import org.w3c.dom.smil.SMILDocument; import org.w3c.dom.smil.SMILDocument;
import org.w3c.dom.smil.SMILElement; import org.w3c.dom.smil.SMILElement;
import org.w3c.dom.smil.SMILLayoutElement; import org.w3c.dom.smil.SMILLayoutElement;
@ -20,7 +18,6 @@ import java.io.ByteArrayOutputStream;
import ws.com.google.android.mms.ContentType; import ws.com.google.android.mms.ContentType;
import ws.com.google.android.mms.pdu.PduBody; import ws.com.google.android.mms.pdu.PduBody;
import ws.com.google.android.mms.pdu.PduParser;
import ws.com.google.android.mms.pdu.PduPart; import ws.com.google.android.mms.pdu.PduPart;
public class SmilUtil { public class SmilUtil {
@ -114,7 +111,9 @@ public class SmilUtil {
} else { } else {
tag = "ref"; tag = "ref";
} }
return createMediaElement(tag, document, new String(part.getName())); return createMediaElement(tag, document, new String(part.getName() == null
? new byte[]{}
: part.getName()));
} }
private static SMILMediaElement createMediaElement(String tag, SMILDocument document, String src) { private static SMILMediaElement createMediaElement(String tag, SMILDocument document, String src) {