Skip to content

Commit 68d27c4

Browse files
committed
8.9.133
1 parent d756e05 commit 68d27c4

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed

Builder/jni/libmupdf-1.21.1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ Java_org_ebookdroid_droids_mupdf_codec_MuPdfOutline_free(JNIEnv
763763

764764
if (doc->ctx && doc)
765765
{
766-
if (doc->outline)
766+
if (doc->outline && doc->outline != NULL)
767767
fz_drop_outline(doc->ctx,doc->outline);
768768
doc->outline = NULL;
769769
}

app/src/main/java/com/foobnix/OpenerActivity.java

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,31 @@ public class OpenerActivity extends Activity {
3232
public static String TAG = "OpenerActivity";
3333

3434
public static String findFileInDownloads(Context context, String name, String id) {
35-
ContentResolver contentResolver = context.getContentResolver();
36-
Uri uri = MediaStore.Files.getContentUri("external");
35+
try {
36+
ContentResolver contentResolver = context.getContentResolver();
37+
Uri uri = MediaStore.Files.getContentUri("external");
3738

38-
String[] projection = {
39-
MediaStore.Files.FileColumns.DATA
40-
};
39+
String[] projection = {
40+
MediaStore.Files.FileColumns.DATA
41+
};
4142

42-
String selection = MediaStore.Files.FileColumns._ID + " = ? AND " +
43-
MediaStore.Files.FileColumns.DISPLAY_NAME + " = ?";
43+
String selection = MediaStore.Files.FileColumns._ID + " = ? AND " +
44+
MediaStore.Files.FileColumns.DISPLAY_NAME + " = ?";
4445

45-
String[] selectionArgs = new String[]{id, name};
46+
String[] selectionArgs = new String[]{id, name};
4647

47-
try (Cursor cursor = contentResolver.query(uri, projection, selection, selectionArgs, null)) {
48-
if (cursor != null && cursor.moveToFirst()) {
49-
int filePathId = cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA);
50-
String filePath = cursor.getString(filePathId);
51-
LOG.d(TAG, "FileFinder", "File Path: " + filePath);
52-
return filePath;
48+
try (Cursor cursor = contentResolver.query(uri, projection, selection, selectionArgs, null)) {
49+
if (cursor != null && cursor.moveToFirst()) {
50+
int filePathId = cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA);
51+
String filePath = cursor.getString(filePathId);
52+
LOG.d(TAG, "FileFinder", "File Path: " + filePath);
53+
return filePath;
54+
}
5355
}
56+
} catch (Exception e) {
57+
LOG.e(e);
5458
}
59+
5560
return null;
5661
}
5762

@@ -131,12 +136,18 @@ protected void onCreate(Bundle savedInstanceState) {
131136
}
132137
if (!file.isFile()) {
133138
LOG.d(TAG, "Find file in getDataPath /indexOf 1");
134-
file = new File(dataPath.substring(dataPath.indexOf("/", 1)));
139+
int beginIndex = dataPath.indexOf("/", 1);
140+
if (beginIndex > 0) {
141+
file = new File(dataPath.substring(beginIndex));
142+
}
135143
LOG.d(TAG, "File:", file.getPath());
136144
}
137145
if (!file.isFile()) {
138146
LOG.d(TAG, "Find file in getDataPath /indexOf 2");
139-
file = new File(dataPath.substring(dataPath.indexOf("/", 1)));
147+
int beginIndex = dataPath.indexOf("/", 1);
148+
if (beginIndex > 0) {
149+
file = new File(dataPath.substring(beginIndex));
150+
}
140151
LOG.d(TAG, "File:", file.getPath());
141152
}
142153

0 commit comments

Comments
 (0)