diff options
author | Matt Holgate <matt@emobix.co.uk> | 2014-06-26 11:51:01 +0100 |
---|---|---|
committer | Matt Holgate <matt@emobix.co.uk> | 2014-06-26 11:59:21 +0100 |
commit | 526ab461bd85cce92d866ee5c4245a6c3636082c (patch) | |
tree | af2149a670981840b86418e11b584dceddc007ce | |
parent | ab8ab6e087f464cab74e1b7d93771eb76ce3c493 (diff) | |
download | mupdf-526ab461bd85cce92d866ee5c4245a6c3636082c.tar.xz |
Fix deleting wrong file or crashing app if first file deleted.
Correct an off-by-one error in the file deletion code.
-rw-r--r-- | platform/ios/Classes/MuLibraryController.m | 4 |
1 files changed, 2 insertions, 2 deletions
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 |