Skip to content

Commit

Permalink
Assign only if exists for #9
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Jun 17, 2023
1 parent 36e3d0e commit 7ebe52f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/gpkg-connection.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ gpkg_connect.geopackage <- function(x) {
obj <- as.character(substitute(x))
x$con <- gpkg_connect(x$dsn)$con
# update object in parent frame
try(assign(obj, x, envir = parent.frame()))
for (o in obj) {
if (exists(o, envir = parent.frame())) {
try(assign(o, x, envir = parent.frame()))
break
}
}
x
}

Expand Down

0 comments on commit 7ebe52f

Please sign in to comment.