Skip to content

Commit b925d64

Browse files
committed
consolidate check on ogc_csw entity handler
1 parent 8f8f78a commit b925d64

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

inst/metadata/entity/entity_handler_ogc_csw.R

+5-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,11 @@ handle_entities_csw <- function(handler, source, config, handle = TRUE){
140140

141141
#doi (in case available)
142142
hasDOI = sapply(rec$identificationInfo[[1]]$citation$identifier, function(identifier){
143-
has = !is.character(identifier$code) & !is.na(identifier$code)
144-
if(has) has = regexpr(pattern = "dx.doi.org", identifier$code$attrs[["xlink:href"]]) > 0
143+
has = FALSE
144+
if(!is.null(identifier)){
145+
has = !is.character(identifier$code) & !is.na(identifier$code)
146+
if(has) has = regexpr(pattern = "dx.doi.org", identifier$code$attrs[["xlink:href"]]) > 0
147+
}
145148
return(has)
146149
})
147150
if(any(hasDOI)){

0 commit comments

Comments
 (0)