Add check for null stream from ContentResolver when encoding

This commit is contained in:
Sean Owen 2014-07-14 15:17:01 +01:00
parent bf6303b4f3
commit db4bf8c255

View file

@ -190,6 +190,9 @@ final class QRCodeEncoder {
InputStream stream = null;
try {
stream = activity.getContentResolver().openInputStream(uri);
if (stream == null) {
throw new WriterException("Can't open stream for " + uri);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[2048];
int bytesRead;