[rkward/kde4] rkward/rbackend: Do not crash on seeing naked bytecode
Thomas Friedrichsmeier
null at kde.org
Mon Apr 16 08:28:34 UTC 2018
Git commit 6ff7cc9530468e41f0e4f0045e71eb8f09187dd8 by Thomas Friedrichsmeier.
Committed on 16/04/2018 at 08:28.
Pushed by tfry into branch 'kde4'.
Do not crash on seeing naked bytecode
M +4 -1 rkward/rbackend/rkstructuregetter.cpp
https://commits.kde.org/rkward/6ff7cc9530468e41f0e4f0045e71eb8f09187dd8
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