Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
am 2e368f6: Do not crash on opening a directory.
Browse files Browse the repository at this point in the history
* commit '2e368f6d87eb82691f855e93f85599b75b489731':
  Do not crash on opening a directory.
  • Loading branch information
Ben Murdoch authored and Android Git Automerger committed Jul 28, 2014
2 parents 2c462a7 + 2e368f6 commit f611ca4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/com/android/htmlviewer/FileContentProvider.java
Expand Up @@ -57,8 +57,11 @@ public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundEx
throw new FileNotFoundException("Bad mode for " + uri + ": " + mode);
}
String filename = uri.getPath();
return ParcelFileDescriptor.open(new File(filename),
ParcelFileDescriptor.MODE_READ_ONLY);
File f = new File(filename);
if (f.isDirectory()) {
return null;
}
return ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
}

@Override
Expand Down

0 comments on commit f611ca4

Please sign in to comment.