Close ParcelFileDescriptor after improting blacklist

This commit is contained in:
xynngh 2020-10-23 14:06:05 +04:00
parent 787ca3c94a
commit 29f7d7b5b5
1 changed files with 20 additions and 12 deletions

View File

@ -248,6 +248,7 @@ public class BlacklistActivity extends AppCompatActivity {
boolean error = false;
ParcelFileDescriptor pfd = null;
try {
try {
pfd = getContentResolver().openFileDescriptor(data.getData(), "r");
} catch (FileNotFoundException e) {
@ -264,6 +265,13 @@ public class BlacklistActivity extends AppCompatActivity {
error = true;
}
}
} finally {
if (pfd != null) {
try {
pfd.close();
} catch (IOException ignored) {}
}
}
if (error) {
Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show();