Skip to content

Commit bb98491

Browse files
committed
Remove unjustified null-forgiving operator on MutatedInstance
1 parent e3d9952 commit bb98491

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/Altinn.App.Api/Controllers/InstancesController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ await _instanceClient.DeleteInstance(
392392
if (!startProcessResult.Success)
393393
return Conflict(startProcessResult.ErrorMessage);
394394

395-
instance = startProcessResult.MutatedInstance!;
395+
instance = startProcessResult.MutatedInstance;
396396
}
397397
catch (Exception exception)
398398
{
@@ -617,7 +617,7 @@ public async Task<ActionResult<InstanceResponse>> PostSimplified(
617617
);
618618
if (!startProcessResult.Success)
619619
return Conflict(startProcessResult.ErrorMessage);
620-
instance = startProcessResult.MutatedInstance!;
620+
instance = startProcessResult.MutatedInstance;
621621
}
622622
catch (Exception exception)
623623
{
@@ -748,7 +748,7 @@ public async Task<ActionResult> CopyInstance(
748748
);
749749
if (!startProcessResult.Success)
750750
return Conflict(startProcessResult.ErrorMessage);
751-
targetInstance = startProcessResult.MutatedInstance!;
751+
targetInstance = startProcessResult.MutatedInstance;
752752

753753
await RegisterEvent("app.instance.created", targetInstance);
754754

src/Altinn.App.Api/Controllers/ProcessController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public async Task<ActionResult<AppProcessState>> StartProcess(
158158
return Conflict(startProcessResult.ErrorMessage);
159159
}
160160

161-
instance = startProcessResult.MutatedInstance!;
161+
instance = startProcessResult.MutatedInstance;
162162

163163
AppProcessState appProcessState = await ConvertAndAuthorizeActions(instance, instance.Process);
164164
return Ok(appProcessState);

src/Altinn.App.Core/Models/Process/ProcessChangeResult.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class ProcessChangeResult
1313
/// Gets or sets a value indicating whether the process change was successful
1414
/// </summary>
1515
[MemberNotNullWhen(true, nameof(ProcessStateChange))]
16+
[MemberNotNullWhen(true, nameof(MutatedInstance))]
1617
[MemberNotNullWhen(false, nameof(ErrorMessage), nameof(ErrorType))]
1718
public bool Success { get; init; }
1819

test/Altinn.App.Core.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4857,14 +4857,17 @@ namespace Altinn.App.Core.Models.Process
48574857
[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, new string?[]?[] {
48584858
"ErrorMessage",
48594859
"ErrorType"})]
4860+
[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "MutatedInstance")]
48604861
[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ProcessStateChange")]
48614862
[get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, new string?[]?[] {
48624863
"ErrorMessage",
48634864
"ErrorType"})]
4865+
[get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "MutatedInstance")]
48644866
[get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ProcessStateChange")]
48654867
[set: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, new string?[]?[] {
48664868
"ErrorMessage",
48674869
"ErrorType"})]
4870+
[set: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "MutatedInstance")]
48684871
[set: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ProcessStateChange")]
48694872
public bool Success { get; init; }
48704873
public System.Collections.Generic.List<Altinn.App.Core.Models.Validation.ValidationIssueWithSource>? ValidationIssues { get; set; }

0 commit comments

Comments
 (0)