diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 5fd0693838cc0614899b5bc47f60b0519b122b54..d0df13d928ab4b05d54cb461fb0a843e604b50d3 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -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; }