[core] Fix leak

This commit is contained in:
LoveSy 2021-11-08 16:26:19 +08:00 committed by GitHub
parent 0d08926eae
commit 2065b84d73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -135,8 +135,9 @@ public class LogcatService implements Runnable {
t.start();
t.join();
var propsLogPath = ConfigFileManager.getpropsLogPath();
var writer = new BufferedWriter(new FileWriter(propsLogPath));
writer.append(sb);
try (var writer = new BufferedWriter(new FileWriter(propsLogPath))) {
writer.append(sb);
}
} catch (IOException | InterruptedException | NullPointerException e) {
Log.e(TAG, "GetProp: " + Arrays.toString(e.getStackTrace()));
}