{
CAMLparam1(arg1);
- GdomeElement* nr;
+ GdomeException exc = 0;
+ GdomeElement* nr = NULL;
CAMLlocal1 (res);
if (arg1==Val_int(0)) {
} else {
nr = (GdomeElement*) Field(Field(arg1,0),1);
}
+
+ if (nr != NULL) {
+ gdome_el_ref(nr, &exc);
+ assert(exc == 0);
+ }
+
res = Val_Element(nr);
if (res==Val_int(0)) {
assert(0);
if (arg1==Val_int(0)) {
res=Val_unit;
} else {
- res = Val_option_ptr((GdomeElement*) Field(Field(arg1,0),1),Val_Element);
+ GdomeException exc = 0;
+ GdomeElement* elem = (GdomeElement*) Field(Field(arg1,0),1);
+ assert(elem != NULL);
+ gdome_el_ref(elem, &exc);
+ assert(exc == 0);
+ res = Val_option_ptr(elem, Val_Element);
}
CAMLreturn(res);