esx: Fix error reporting in esxVI_LookupManagedObjectHelper

As the name parameter can be NULL the error message can only contain it
conditionally.
This commit is contained in:
Matthias Bolte 2013-05-15 23:43:04 +02:00
parent ec04914c47
commit 9bf5246f97

View File

@ -5140,8 +5140,14 @@ esxVI_LookupManagedObjectHelper(esxVI_Context *ctx,
if (candidate == NULL) {
if (occurrence != esxVI_Occurrence_OptionalItem) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not find %s with name '%s'"), type, name);
if (name != NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not find %s with name '%s'"), type, name);
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not find %s"), type);
}
goto cleanup;
}