android - Email app crashes if a photo is not available for attachment -


my app has option take photo, later attached email. works fine.

the problem is, crashes if there's no photo taken. idea how can fix this?

here's button code, in case comes handy somehow.

button sendmail = (button) findviewbyid(r.id.sendemail); sendmail.setonclicklistener(new view.onclicklistener() {      @override     public void onclick(view v) {         // todo auto-generated method stub          intent emailintent = new intent(intent.action_send);          emailintent.putextra(intent.extra_email, new string[]{"somemail@mail.com"});         emailintent.putextra(intent.extra_subject, "subject");         emailintent.putextra(intent.extra_text, "body");         emailintent.settype("message/rfc822");         emailintent.putextra(intent.extra_stream, imageuri);         startactivity(intent.createchooser(emailintent, "choose email client"));     } }); 


Comments