[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [libvirt-glib 02/23] gvir_config_object_parse: don't parse empty documents



On Fri, Oct 07, 2011 at 11:40:47AM +0200, Christophe Fergeau wrote:
> Report an error when trying to parse the current XML document
> associated with the GVirConfig object when no document has been
> set.
> ---
>  libvirt-gconfig/libvirt-gconfig-object.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
> index 4a58323..6f80346 100644
> --- a/libvirt-gconfig/libvirt-gconfig-object.c
> +++ b/libvirt-gconfig/libvirt-gconfig-object.c
> @@ -187,6 +187,14 @@ gvir_config_object_parse(GVirConfigObject *config,
>      if (priv->docHandle)
>          return;
>  
> +    if (!priv->doc) {
> +        *err = g_error_new(GVIR_CONFIG_OBJECT_ERROR,
> +                           0,
> +                           "%s",
> +                           "No XML document to parse");
> +        return;
> +    }
> +
>      priv->docHandle = xmlParseMemory(priv->doc, strlen(priv->doc));
>      if (!priv->docHandle) {
>          *err = gvir_xml_error_new(GVIR_CONFIG_OBJECT_ERROR,

ACK

Seeing this string message reminds me that we should add I18N gettext
support to this library sometime soon.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]