mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Add check for null stream from ContentResolver when encoding
This commit is contained in:
parent
bf6303b4f3
commit
db4bf8c255
|
@ -190,6 +190,9 @@ final class QRCodeEncoder {
|
||||||
InputStream stream = null;
|
InputStream stream = null;
|
||||||
try {
|
try {
|
||||||
stream = activity.getContentResolver().openInputStream(uri);
|
stream = activity.getContentResolver().openInputStream(uri);
|
||||||
|
if (stream == null) {
|
||||||
|
throw new WriterException("Can't open stream for " + uri);
|
||||||
|
}
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
byte[] buffer = new byte[2048];
|
byte[] buffer = new byte[2048];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
|
|
Loading…
Reference in a new issue