Skip to content

Commit 2eea764

Browse files
avneeshraiusitshahabhijeet
authored andcommitted
Fixing null reference issues introduced with support for ShouldProcess (#4202)
1 parent 626b3cc commit 2eea764

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/Job/RestartAzureRmRecoveryServicesAsrJob.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ public override void ExecuteSiteRecoveryCmdlet()
5555
{
5656
base.ExecuteSiteRecoveryCmdlet();
5757

58+
if (this.InputObject != null)
59+
{
60+
this.Name = this.InputObject.Name;
61+
}
62+
5863
if (this.ShouldProcess(
59-
this.InputObject.Name,
64+
this.Name,
6065
VerbsLifecycle.Restart))
6166
{
6267
switch (this.ParameterSetName)

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/Job/ResumeAzureRmRecoveryServicesAsrJob.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ public override void ExecuteSiteRecoveryCmdlet()
6464
{
6565
base.ExecuteSiteRecoveryCmdlet();
6666

67+
if (this.InputObject != null)
68+
{
69+
this.Name = this.InputObject.Name;
70+
}
71+
6772
if (this.ShouldProcess(
68-
this.InputObject.Name,
73+
this.Name,
6974
VerbsLifecycle.Resume))
7075
{
7176
switch (this.ParameterSetName)

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/Job/StopAzureRmRecoveryServicesAsrJob.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ public override void ExecuteSiteRecoveryCmdlet()
5555
{
5656
base.ExecuteSiteRecoveryCmdlet();
5757

58+
if (this.InputObject != null)
59+
{
60+
this.Name = this.InputObject.Name;
61+
}
62+
5863
if (this.ShouldProcess(
59-
this.InputObject.Name,
64+
this.Name,
6065
VerbsLifecycle.Stop))
6166
{
6267
switch (this.ParameterSetName)

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/RecoveryPlan/NewAzureRmRecoveryServicesAsrRecoveryPlan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public override void ExecuteSiteRecoveryCmdlet()
135135
base.ExecuteSiteRecoveryCmdlet();
136136

137137
if (this.ShouldProcess(
138-
this.Name,
138+
"Recovery plan",
139139
VerbsCommon.New))
140140
{
141141
switch (this.ParameterSetName)

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/RecoveryPlan/RemoveAzureRmRecoveryServicesAsrRecoveryPlan.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ public override void ExecuteSiteRecoveryCmdlet()
5656
{
5757
base.ExecuteSiteRecoveryCmdlet();
5858

59+
if (this.InputObject != null)
60+
{
61+
this.Name = this.InputObject.Name;
62+
}
63+
5964
if (this.ShouldProcess(
60-
this.InputObject.FriendlyName,
65+
this.Name,
6166
VerbsCommon.Remove))
6267
{
6368
if (string.Compare(

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/RecoveryPlan/UpdateAzureRmRecoveryServicesAsrRecoveryPlan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public override void ExecuteSiteRecoveryCmdlet()
6161
base.ExecuteSiteRecoveryCmdlet();
6262

6363
if (this.ShouldProcess(
64-
this.InputObject.FriendlyName,
64+
"Recovery plan",
6565
VerbsData.Update))
6666
{
6767
switch (this.ParameterSetName)

0 commit comments

Comments
 (0)