@@ -152,7 +152,10 @@ public BackUpOperationStatusResponse WaitForOperationCompletionUsingStatusLink(
152
152
// protected item and policy.
153
153
BackUpOperationStatusResponse response = hydraFunc ( statusUrlLink ) ;
154
154
155
- while ( response . OperationStatus . Status == OperationStatusValues . InProgress . ToString ( ) )
155
+ while (
156
+ response != null &&
157
+ response . OperationStatus != null &&
158
+ response . OperationStatus . Status == OperationStatusValues . InProgress . ToString ( ) )
156
159
{
157
160
WriteDebug ( "Tracking operation completion using status link: " + statusUrlLink ) ;
158
161
TestMockSupport . Delay ( _defaultSleepForOperationTracking * 1000 ) ;
@@ -171,23 +174,27 @@ protected void HandleCreatedJob(BaseRecoveryServicesJobResponse itemResponse, st
171
174
itemResponse . AzureAsyncOperation ,
172
175
HydraAdapter . GetProtectedItemOperationStatusByURL ) ;
173
176
174
- WriteDebug ( Resources . FinalOperationStatus + response . OperationStatus . Status ) ;
175
-
176
- if ( response . OperationStatus . Properties != null &&
177
- ( ( OperationStatusJobExtendedInfo ) response . OperationStatus . Properties ) . JobId != null )
177
+ if ( response != null && response . OperationStatus != null )
178
178
{
179
- var jobStatusResponse = ( OperationStatusJobExtendedInfo ) response . OperationStatus . Properties ;
180
- WriteObject ( GetJobObject ( jobStatusResponse . JobId ) ) ;
181
- }
179
+ WriteDebug ( Resources . FinalOperationStatus + response . OperationStatus . Status ) ;
182
180
183
- if ( response . OperationStatus . Status == OperationStatusValues . Failed )
184
- {
185
- var errorMessage = string . Format (
186
- Resources . OperationFailed ,
187
- operationName ,
188
- response . OperationStatus . OperationStatusError . Code ,
189
- response . OperationStatus . OperationStatusError . Message ) ;
190
- throw new Exception ( errorMessage ) ;
181
+ if ( response . OperationStatus . Properties != null &&
182
+ ( ( OperationStatusJobExtendedInfo ) response . OperationStatus . Properties ) . JobId != null )
183
+ {
184
+ var jobStatusResponse = ( OperationStatusJobExtendedInfo ) response . OperationStatus . Properties ;
185
+ WriteObject ( GetJobObject ( jobStatusResponse . JobId ) ) ;
186
+ }
187
+
188
+ if ( response . OperationStatus . Status == OperationStatusValues . Failed &&
189
+ response . OperationStatus . OperationStatusError != null )
190
+ {
191
+ var errorMessage = string . Format (
192
+ Resources . OperationFailed ,
193
+ operationName ,
194
+ response . OperationStatus . OperationStatusError . Code ,
195
+ response . OperationStatus . OperationStatusError . Message ) ;
196
+ throw new Exception ( errorMessage ) ;
197
+ }
191
198
}
192
199
}
193
200
}
0 commit comments