Add null check to reports

This commit is contained in:
Hillel Coren 2022-01-18 18:05:32 +02:00
parent aee9827740
commit 49cde7296e
1 changed files with 7 additions and 3 deletions

View File

@ -1229,9 +1229,13 @@ class ReportResult {
final rows = <DataRow>[];
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final reportSettings = state.userCompany.settings
?.reportSettings[state.uiState.reportsUIState.report] ??
ReportSettingsEntity();
final reportState = state.uiState.reportsUIState;
final settings = state.userCompany.settings;
final reportSettings = settings != null &&
settings.reportSettings.containsKey(reportState.report)
? settings.reportSettings[reportState.report]
: ReportSettingsEntity();
final Map<String, Map<String, double>> totals = {};
final allColumns = <String>[];