[education/rkward] rkward/rbackend: Silence startup warnings
Thomas Friedrichsmeier
null at kde.org
Sun Aug 24 16:08:55 BST 2025
Git commit 473c875b9360942a5cffdb45d881bdbe2ee053db by Thomas Friedrichsmeier.
Committed on 24/08/2025 at 15:06.
Pushed by tfry into branch 'master'.
Silence startup warnings
M +8 -3 rkward/rbackend/rkstructuregetter.cpp
https://invent.kde.org/education/rkward/-/commit/473c875b9360942a5cffdb45d881bdbe2ee053db
diff --git a/rkward/rbackend/rkstructuregetter.cpp b/rkward/rbackend/rkstructuregetter.cpp
index c488c9e13..b1505b017 100644
--- a/rkward/rbackend/rkstructuregetter.cpp
+++ b/rkward/rbackend/rkstructuregetter.cpp
@@ -433,9 +433,14 @@ void RKStructureGetter::getStructureWorker(SEXP val, const QString &name, int ad
}
} else if (is_function) {
// TODO: getting the formals is still a bit of a bottleneck, but no idea, how to improve on this, any further
- SEXP formals_s;
- if (RFn::Rf_isPrimitive(value)) formals_s = RFn::FORMALS(RKRSupport::callSimpleFun(args_fun, value, baseenv)); // primitives don't have formals, internally
- else formals_s = RFn::FORMALS(value);
+ SEXP formals_s = ROb(R_NilValue);
+ if (RFn::Rf_isPrimitive(value)) {
+ // primitives don't have formals, internally
+ auto args = RKRSupport::callSimpleFun(args_fun, value, baseenv);
+ if (!RFn::Rf_isNull(args)) formals_s = RFn::FORMALS(args);
+ } else {
+ formals_s = RFn::FORMALS(value);
+ }
RFn::Rf_protect(formals_s);
// get the default values
More information about the rkward-tracker
mailing list