Prevent null reference when importing OVF files from web server

Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
Danilo Del Busso 2021-09-09 11:35:02 +01:00 committed by Konstantina Chremmou
parent 7d9bbbc68b
commit 46b83bf3a4

View File

@ -754,11 +754,14 @@ namespace XenAdmin.Wizards.ImportWizard
int index = _uri.OriginalString.LastIndexOf('/') + 1;
var remoteDir = _uri.OriginalString.Substring(0, index);
foreach (var file in envType.References.File)
if (envType.References.File != null)
{
var remoteUri = new Uri(remoteDir + file.href);
var localPath = Path.Combine(_downloadFolder, file.href);
_filesToDownload.Enqueue(new ApplianceFile(remoteUri, localPath));
foreach (var file in envType.References.File)
{
var remoteUri = new Uri(remoteDir + file.href);
var localPath = Path.Combine(_downloadFolder, file.href);
_filesToDownload.Enqueue(new ApplianceFile(remoteUri, localPath));
}
}
}
}