From 56ee7f8b7cb805ba9f6ba6ddb18c0cb17c3b2e77 Mon Sep 17 00:00:00 2001 From: Andrew Sliwinski Date: Wed, 6 Apr 2016 18:22:50 -0400 Subject: [PATCH] Prevent crash bug edge case with sharing by email. Resolves GH-500 --- ios/ScratchJr/src/ViewController.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ios/ScratchJr/src/ViewController.m b/ios/ScratchJr/src/ViewController.m index 00369c2..5ccb25d 100644 --- a/ios/ScratchJr/src/ViewController.m +++ b/ios/ScratchJr/src/ViewController.m @@ -342,6 +342,9 @@ JSContext *js; mimeType = @"application/x-pbskids-scratchjr-project"; #endif + // Check to ensure modal is not nil. This can occur when the user does not have a mail account configured on their device + if (mailComposeViewController == nil) return; + [mailComposeViewController addAttachmentData:projectData mimeType:mimeType fileName:filename]; [self presentViewController:mailComposeViewController animated:YES completion:nil]; });