Skip to content

Commit 1130bc2

Browse files
author
ripley
committed
optionally maka as.{double,integer}(NULL} an error to help debugging
git-svn-id: https://svn.r-project.org/R/trunk@87408 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 299a017 commit 1130bc2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/coerce.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,14 @@ static SEXP ascommon(SEXP call, SEXP u, SEXPTYPE type)
13901390
else if (isVector(u) || isList(u) || isLanguage(u)
13911391
|| (isSymbol(u) && type == EXPRSXP)) {
13921392
SEXP v;
1393+
#ifdef R_LESS_COERCION_FROM_NULL
1394+
if(TYPEOF(u) == NILSXP && type == REALSXP)
1395+
errorcall(call, _(COERCE_ERROR_STRING),
1396+
R_typeToChar(u), type2char(type));
1397+
if(TYPEOF(u) == NILSXP && type == INTSXP)
1398+
errorcall(call, _(COERCE_ERROR_STRING),
1399+
R_typeToChar(u), type2char(type));
1400+
#endif
13931401
if (type != ANYSXP && TYPEOF(u) != type) v = coerceVector(u, type);
13941402
else v = u;
13951403

0 commit comments

Comments
 (0)