Don't crash on null extension

pull/127/merge
Alex Baker 8 years ago
parent 3f13a34e05
commit 99ee0248a7

@ -31,6 +31,8 @@ import javax.inject.Inject;
import timber.log.Timber; import timber.log.Timber;
import static com.google.common.base.Strings.isNullOrEmpty;
public class AddAttachmentActivity extends InjectingAppCompatActivity implements DialogInterface.OnCancelListener, AddAttachmentDialog.AddAttachmentCallback { public class AddAttachmentActivity extends InjectingAppCompatActivity implements DialogInterface.OnCancelListener, AddAttachmentDialog.AddAttachmentCallback {
private static final String FRAG_TAG_ATTACHMENT_DIALOG = "frag_tag_attachment_dialog"; private static final String FRAG_TAG_ATTACHMENT_DIALOG = "frag_tag_attachment_dialog";
@ -159,7 +161,9 @@ public class AddAttachmentActivity extends InjectingAppCompatActivity implements
private File getFilename(String extension) { private File getFilename(String extension) {
AtomicReference<String> nameRef = new AtomicReference<>(); AtomicReference<String> nameRef = new AtomicReference<>();
if (!extension.startsWith(".")) { if (isNullOrEmpty(extension)) {
extension = "";
} else if (!extension.startsWith(".")) {
extension = "." + extension; extension = "." + extension;
} }
try { try {

Loading…
Cancel
Save