From 26962a45c8acfa111464ff749a1bd2e536a6e49a Mon Sep 17 00:00:00 2001 From: Gillardo Date: Tue, 2 Jun 2020 17:45:55 +0100 Subject: [PATCH] Update FileOpener2.m Updated to check if positions passed in --- src/ios/FileOpener2.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ios/FileOpener2.m b/src/ios/FileOpener2.m index 45c4536..7161705 100644 --- a/src/ios/FileOpener2.m +++ b/src/ios/FileOpener2.m @@ -83,10 +83,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //Opens the file preview CGRect rect; - if ([command.arguments count] >= 4 - && ![[command.arguments objectAtIndex:3] isEqual: [NSNull null]]) { + if ([command.arguments count] >= 4) { NSArray *positionValues = [command.arguments objectAtIndex:3]; - rect = CGRectMake(0, 0, [[positionValues objectAtIndex:0] floatValue], [[positionValues objectAtIndex:1] floatValue]); + + if (![positionValues isEqual:[NSNull null]] && [positionValues count] >= 2) { + rect = CGRectMake(0, 0, [[positionValues objectAtIndex:0] floatValue], [[positionValues objectAtIndex:1] floatValue]); + } else { + rect = CGRectMake(0, 0, 0, 0); + } } else { rect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height); }