From 9647b525af0867144a71f83d4c3bae868a698123 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Tue, 20 Feb 2018 06:47:00 +1100 Subject: [PATCH] Patch a bug in is.subcladeof --- src/robitax.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/robitax.c b/src/robitax.c index 8445e3e..2c505e1 100644 --- a/src/robitax.c +++ b/src/robitax.c @@ -622,7 +622,12 @@ SEXP R_is_under_taxon(SEXP Rtaxonomy, SEXP Rtaxid, SEXP Rparent) prep[i]=NA_LOGICAL; else { taxon = eco_findtaxonbytaxid(ptax, ptaxid[i]); - prep[i] = eco_isundertaxon(taxon, parent); + if (taxon) { + prep[i] = eco_isundertaxon(taxon, parent); + } + else { + prep[i]=NA_LOGICAL; + } } } }