Skip to content

Commit e57658b

Browse files
committed
fix bug in variant -> sexp
empty value should be NA (int), not NULL
1 parent cb2c59e commit e57658b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

BERT/BERTAPI.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ SEXP __stdcall BERTAPI_CreateDispatch(const char *progid) {
8484

8585
}
8686
else {
87-
std::cout << "cocreateinstance failed" << std::endl;
87+
// std::cout << "cocreateinstance failed" << std::endl;
8888
// FIXME: error
8989
}
9090

@@ -104,7 +104,8 @@ SEXP __stdcall BERTAPI_CreateExcelInstance() {
104104

105105
pdisp->AddRef();
106106
int rc = pdisp->Release();
107-
std::cout << "cocreateinstance succeeded (rc " << rc << ")" << std::endl;
107+
108+
//std::cout << "cocreateinstance succeeded (rc " << rc << ")" << std::endl;
108109

109110
// create an outside env to hold the application and enums
110111
SEXP e = PROTECT(R_tryEval(Rf_lang1(Rf_install("new.env")), R_GlobalEnv, &err));

BERT/RCOM.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ SEXP Variant2SEXP(CComVariant &cv) {
689689

690690
SEXP s = Rf_allocMatrix(VECSXP, rows, cols);
691691
int index = 0;
692-
692+
693693
switch (vt) {
694694
case VT_BSTR:
695695
{
@@ -770,7 +770,9 @@ SEXP Variant2SEXP(CComVariant &cv) {
770770

771771
switch (vt) {
772772
case VT_EMPTY:
773-
return R_NilValue;
773+
//return R_NilValue;
774+
return ScalarInteger(R_NaInt);
775+
//return R_NaString;
774776
case VT_NULL:
775777
return R_NilValue;
776778
case VT_R4:

0 commit comments

Comments
 (0)