diff --git a/lib/handlers/file_handler.dart b/lib/handlers/file_handler.dart index 068f504..4e8733b 100644 --- a/lib/handlers/file_handler.dart +++ b/lib/handlers/file_handler.dart @@ -55,7 +55,7 @@ class FileHandler extends ReportHandler { Future _processReport(Report report) async { if (_fileValidationResult) { - await _openFile(report); + await _openFile(); await _writeReportToFile(report); await _closeFile(); return true; @@ -83,7 +83,11 @@ class FileHandler extends ReportHandler { } } - Future _openFile(Report report) async { + Future _openFile() async { + if (_openedFile == null) { + _printLog('Could not open file'); + return; + } _sink = _openedFile!.openWrite(mode: FileMode.append); _printLog('Opened file'); }