fix(app): the text to hash may be null
Qodana's full analysis of main flagged `Text ?? string.Empty` as never null. The text box can set null when it is cleared, so the property is declared nullable instead of dropping the guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a566991f26
commit
7b0f252306
1 file changed
+3
-2
@@ -48,7 +48,8 @@ public sealed partial class TextHashViewModel : ObservableObject
|
||||
private long _byteCount;
|
||||
|
||||
[ObservableProperty] private LocalizationProxy _localization;
|
||||
[ObservableProperty] private string _text = string.Empty;
|
||||
/// <summary>The text to hash; the text box can set null when it is cleared.</summary>
|
||||
[ObservableProperty] private string? _text = string.Empty;
|
||||
[ObservableProperty] private TextEncodingOption _selectedEncoding;
|
||||
[ObservableProperty] private LineBreak _selectedLineBreak = LineBreak.Lf;
|
||||
[ObservableProperty] private string _sizeText = string.Empty;
|
||||
@@ -91,7 +92,7 @@ public sealed partial class TextHashViewModel : ObservableObject
|
||||
/// <summary>The latest computation; tests wait for it.</summary>
|
||||
internal Task Pending { get; private set; } = Task.CompletedTask;
|
||||
|
||||
partial void OnTextChanged(string value) => Recompute(immediately: false);
|
||||
partial void OnTextChanged(string? value) => Recompute(immediately: false);
|
||||
|
||||
partial void OnSelectedEncodingChanged(TextEncodingOption value) => Recompute(immediately: true);
|
||||
|
||||
|
||||
Reference in new issue
Block a user