Skip to content

Commit 409a504

Browse files
committed
Clean up FileHandler
1 parent 9117bd4 commit 409a504

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/handlers/file_handler.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class FileHandler extends ReportHandler {
5555

5656
Future<bool> _processReport(Report report) async {
5757
if (_fileValidationResult) {
58-
await _openFile(report);
58+
await _openFile();
5959
await _writeReportToFile(report);
6060
await _closeFile();
6161
return true;
@@ -83,7 +83,11 @@ class FileHandler extends ReportHandler {
8383
}
8484
}
8585

86-
Future<void> _openFile(Report report) async {
86+
Future<void> _openFile() async {
87+
if (_openedFile == null) {
88+
_printLog('Could not open file');
89+
return;
90+
}
8791
_sink = _openedFile!.openWrite(mode: FileMode.append);
8892
_printLog('Opened file');
8993
}

0 commit comments

Comments
 (0)