access: report an error if no access manager is present

The code calling this method expects it to have reported an error on
failure.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-05-17 12:28:27 +01:00
parent 39a7dff726
commit cccc3fc1bb

View File

@ -65,6 +65,12 @@ VIR_ONCE_GLOBAL_INIT(virAccessManager);
virAccessManagerPtr virAccessManagerGetDefault(void)
{
if (virAccessManagerDefault == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("No access manager registered"));
return NULL;
}
return virObjectRef(virAccessManagerDefault);
}