From 526ab461bd85cce92d866ee5c4245a6c3636082c Mon Sep 17 00:00:00 2001 From: Matt Holgate Date: Thu, 26 Jun 2014 11:51:01 +0100 Subject: Fix deleting wrong file or crashing app if first file deleted. Correct an off-by-one error in the file deletion code. --- platform/ios/Classes/MuLibraryController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'platform/ios/Classes/MuLibraryController.m') diff --git a/platform/ios/Classes/MuLibraryController.m b/platform/ios/Classes/MuLibraryController.m index 25ca6ea0..ef5c9624 100644 --- a/platform/ios/Classes/MuLibraryController.m +++ b/platform/ios/Classes/MuLibraryController.m @@ -93,7 +93,7 @@ static void showAlert(NSString *msg, NSString *filename) strcpy(filename, [NSHomeDirectory() UTF8String]); strcat(filename, "/Documents/"); - strcat(filename, [[files objectAtIndex: row - 1] UTF8String]); + strcat(filename, [[files objectAtIndex: row] UTF8String]); printf("delete document '%s'\n", filename); @@ -106,7 +106,7 @@ static void showAlert(NSString *msg, NSString *filename) - (void) onTapDelete: (UIControl*)sender { int row = [sender tag]; - NSString *title = [NSString stringWithFormat: @"Delete %@?", [files objectAtIndex: row - 1]]; + NSString *title = [NSString stringWithFormat: @"Delete %@?", [files objectAtIndex:row]]; UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle: title delegate: self -- cgit v1.2.3