Skip to content

Commit 2be179f

Browse files
committed
Adding Null Protection in Few Blazor Components to Fix Design Time Analyzer Errors
1 parent 2fb1f39 commit 2be179f

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

MESS/MESS.Blazor/Components/Pages/Phoebe/MenuBar/MenuBarPhoebe.razor

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,19 @@
164164
Visible="@_showExportDialog"
165165
VisibleChanged="@(val => _showExportDialog = val)" />
166166

167-
<ProductAssociationDialog
168-
AllProducts="@Products"
169-
SelectedProducts="@(ActiveDialog.SelectedProductNames)"
170-
SelectedProductsChanged="OnDialogProductsChanged"
171-
IsVisible="@ActiveDialog.IsVisible"
172-
IsVisibleChanged="@(val => ActiveDialog.IsVisible = val)"
173-
HeaderText="@ActiveDialog.HeaderText"
174-
ConfirmButtonText="@ActiveDialog.ConfirmButtonText"
175-
AllowsRenaming="@(ActiveDialog.Type == DialogType.SaveAs)"
176-
OnConfirmed="HandleDialogConfirmed" />
167+
@if (Products is not null)
168+
{
169+
<ProductAssociationDialog
170+
AllProducts="@Products"
171+
SelectedProducts="@(ActiveDialog.SelectedProductNames)"
172+
SelectedProductsChanged="OnDialogProductsChanged"
173+
IsVisible="@ActiveDialog.IsVisible"
174+
IsVisibleChanged="@(val => ActiveDialog.IsVisible = val)"
175+
HeaderText="@ActiveDialog.HeaderText"
176+
ConfirmButtonText="@ActiveDialog.ConfirmButtonText"
177+
AllowsRenaming="@(ActiveDialog.Type == DialogType.SaveAs)"
178+
OnConfirmed="HandleDialogConfirmed" />
179+
}
177180

178181
@code {
179182
private string? ActiveLineOperator { get; set; }

MESS/MESS.Blazor/Components/Pages/Phoebe/WorkInstruction/Export/WorkInstructionExportDialog.razor

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@
3232
</FluentDialogBody>
3333

3434
<FluentDialogFooter>
35-
<WorkInstructionExportButton
36-
@ref="_exportButton"
37-
WorkInstruction="WorkInstruction"
38-
OnDownloadComplete="Close"
39-
OnDownloadStateChanged="HandleDownloadStateChanged"
40-
OnProgressChanged="HandleProgressChanged"/>
41-
35+
@if (WorkInstruction is not null)
36+
{
37+
<WorkInstructionExportButton
38+
@ref="_exportButton"
39+
WorkInstruction="WorkInstruction"
40+
OnDownloadComplete="Close"
41+
OnDownloadStateChanged="HandleDownloadStateChanged"
42+
OnProgressChanged="HandleProgressChanged"/>
43+
}
44+
4245
<button type="button"
4346
class="btn btn-sm btn-outline-secondary"
4447
@onclick="CancelExport">

0 commit comments

Comments
 (0)