Avoid NPE if opening a shared input stream fails

This commit is contained in:
Peter Osterlund 2020-09-28 19:27:13 +02:00
parent ca39ffbf09
commit d4e899b6be

View File

@ -795,6 +795,8 @@ public class DroidFish extends Activity
String fn = Environment.getExternalStorageDirectory() + sep + String fn = Environment.getExternalStorageDirectory() + sep +
pgnDir + sep + ".sharedfile.pgn"; pgnDir + sep + ".sharedfile.pgn";
try (InputStream in = resolver.openInputStream(data)) { try (InputStream in = resolver.openInputStream(data)) {
if (in == null)
throw new IOException("No input stream");
FileUtil.writeFile(in, fn); FileUtil.writeFile(in, fn);
} }
PGNFile pgnFile = new PGNFile(fn); PGNFile pgnFile = new PGNFile(fn);