Skip to content

Commit

Permalink
Merge pull request #91 from MabOneSdk/csm-pikumar
Browse files Browse the repository at this point in the history
checking for null response
  • Loading branch information
pikumarmsft16 committed Jul 28, 2015
2 parents 0250d89 + b712e42 commit 8819fd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,18 @@ public override void ExecuteCmdlet()

var azureBackupDatasourceListResponse = AzureBackupClient.ListDataSources(DSQueryParam);

azureBackupDatasourceObjects = azureBackupDatasourceListResponse.Where(x => x.Properties.ContainerId.Split('/').Last().Equals(Container.ContainerUniqueName, System.StringComparison.InvariantCultureIgnoreCase)).ToList();
if (azureBackupDatasourceListResponse != null)
{
azureBackupDatasourceObjects = azureBackupDatasourceListResponse.Where(x => x.Properties.ContainerId.Split('/').Last().Equals(Container.ContainerUniqueName, System.StringComparison.InvariantCultureIgnoreCase)).ToList();
}

if (this.Status == null)
{
var azureBackupPOListResponse = AzureBackupClient.ListProtectableObjects(POQueryParam);
azureBackupPOObjects = azureBackupPOListResponse.Where(x => x.Properties.ContainerId.Split('/').Last().Equals(Container.ContainerUniqueName, System.StringComparison.InvariantCultureIgnoreCase)).ToList();
if (azureBackupPOListResponse != null)
{
azureBackupPOObjects = azureBackupPOListResponse.Where(x => x.Properties.ContainerId.Split('/').Last().Equals(Container.ContainerUniqueName, System.StringComparison.InvariantCultureIgnoreCase)).ToList();
}
}

WriteDebug("Received azure backup item response");
Expand All @@ -90,9 +96,12 @@ public void WriteAzureBackupItem(List<CSMProtectedItemResponse> sourceDataSource
{
List<AzureBackupItem> targetList = new List<AzureBackupItem>();

foreach (var item in sourceDataSourceList)
if (sourceDataSourceList != null)
{
targetList.Add(new AzureBackupItem(item, azureBackupContainer));
foreach (var item in sourceDataSourceList)
{
targetList.Add(new AzureBackupItem(item, azureBackupContainer));
}
}

if (sourcePOList != null)
Expand Down
Binary file not shown.

0 comments on commit 8819fd3

Please sign in to comment.