[rkward] rkward/rbackend: Do not crash on seeing naked bytecode
Thomas Friedrichsmeier
null at kde.org
Mon Apr 9 08:23:44 UTC 2018
Git commit db417df4cddded08a823fd2f3c8defd46f965144 by Thomas Friedrichsmeier.
Committed on 09/04/2018 at 08:23.
Pushed by tfry into branch 'master'.
Do not crash on seeing naked bytecode
M +4 -1 rkward/rbackend/rkstructuregetter.cpp
https://commits.kde.org/rkward/db417df4cddded08a823fd2f3c8defd46f965144
diff --git a/rkward/rbackend/rkstructuregetter.cpp b/rkward/rbackend/rkstructuregetter.cpp
index f2502ab8..ba753475 100644
--- a/rkward/rbackend/rkstructuregetter.cpp
+++ b/rkward/rbackend/rkstructuregetter.cpp
@@ -194,7 +194,7 @@ void RKStructureGetter::getStructureWorker (SEXP val, const QString &name, int a
SEXP classes_s;
QStringList classes;
- if ((TYPEOF (value) == LANGSXP) || (TYPEOF (value) == SYMSXP)) { // if it's a call, we should NEVER send it through eval
+ if ((TYPEOF (value) == LANGSXP) || (TYPEOF (value) == SYMSXP) || (TYPEOF (value) == BCODESXP)) { // if it's a call, we should NEVER send it through eval
// stripped down and adjusted from R_data_class
PROTECT (classes_s = Rf_getAttrib (value, R_ClassSymbol));
if (Rf_length (classes_s)) classes = RKRSupport::SEXPToStringList(classes_s);
@@ -207,6 +207,9 @@ void RKStructureGetter::getStructureWorker (SEXP val, const QString &name, int a
UNPROTECT (1);
if ((cl != "if") && (cl != "while") && (cl != "for") && (cl != "=") && (cl != "<-") && (cl != "(") && (cl != "{")) cl = "call";
classes = QStringList (cl);
+ } else if (TYPEOF (value) == BCODESXP) {
+ value = R_NilValue; // This is a bit lame, but bytecode cannot be cast to expression, below, and no idea what else to do with it (or what info to extract, anyway)
+ classes = QStringList("bytecode");
} else {
classes = QStringList ("name");
}
More information about the rkward-tracker
mailing list