I'm not sure if this indicates that the xpath expression is wrong, but in any case it can be that xpathobj->nodesetval is NULL. In this case, return 0 from xpathobj_nr_nodes instead of segfaulting. --- v2v/xml-c.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/v2v/xml-c.c b/v2v/xml-c.c index a1b796c..cf5bff2 100644 --- a/v2v/xml-c.c +++ b/v2v/xml-c.c @@ -165,7 +165,10 @@ v2v_xml_xpathobj_nr_nodes (value xpathobjv) CAMLparam1 (xpathobjv); xmlXPathObjectPtr xpathobj = Xpathobj_val (xpathobjv); - CAMLreturn (Val_int (xpathobj->nodesetval->nodeNr)); + if (xpathobj->nodesetval == NULL) + CAMLreturn (Val_int (0)); + else + CAMLreturn (Val_int (xpathobj->nodesetval->nodeNr)); } value -- 1.9.0 _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
