X-Git-Url: http://git.annexia.org/?p=ocaml-augeas.git;a=blobdiff_plain;f=augeas-c.c;h=b81c2b15776291bc56e0bcdc54a91d76c6a54516;hp=f4396cb91d431fa345332d25f3382ef55f3677cc;hb=a9c904a256cb10be03995e265c8446be87b73284;hpb=8c1d2d318a5b3b5746a5ccac56d9e4512e5e588d diff --git a/augeas-c.c b/augeas-c.c index f4396cb..b81c2b1 100644 --- a/augeas-c.c +++ b/augeas-c.c @@ -206,11 +206,11 @@ ocaml_augeas_get (value tv, value pathv) int r; r = aug_get (t, path, &val); - if (r == 1) { /* Return Some val */ + if (r == 1 && val) { /* Return Some val */ v = caml_copy_string (val); optv = caml_alloc (1, 0); Field (optv, 0) = v; - } else if (r == 0) /* Return None */ + } else if (r == 0 || !val) /* Return None */ optv = Val_int (0); else if (r == -1) /* Error or multiple matches */ raise_error (t, "Augeas.get");