Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/ark/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2381,7 +2381,9 @@ fn do_resource_namespaces() -> bool {
/// `WriteConsoleExt()` method so that we don't have to rely on these fragile
/// and incomplete inferences.
fn is_auto_printing() -> bool {
let n_frame = harp::session::r_n_frame().unwrap();
let Ok(n_frame) = harp::session::r_n_frame() else {
return false;
};

// The call-stack is empty so this must be R auto-printing an unclassed object
if n_frame == 0 {
Expand All @@ -2394,10 +2396,12 @@ fn is_auto_printing() -> bool {
// let browser = harp::session::r_env_is_browsed(last_frame.sexp).unwrap();

// Detect the `print()` call generated by auto-print with classed objects.
// In tat case the first frame of the stack is a call to `print()` with the
// In that case the first frame of the stack is a call to `print()` with the
// function inlined in CAR. This inlining disambiguates with the user typing
// a `print()` call at top-level. (Similar logic for the S4 generic `show()`.)
let call = harp::session::r_sys_call(1).unwrap();
let Ok(call) = harp::session::r_sys_call(1) else {
return false;
};

// For safety
if r_typeof(call.sexp) != libr::LANGSXP {
Expand Down
Loading