Skip to content

editImage: return an error instead of crashing the engine - #225

Open
boutinb wants to merge 1 commit into
jasp-stats:masterfrom
boutinb:editImageErrorDoesNotCrashEngine
Open

boutinb wants to merge 1 commit into
jasp-stats:masterfrom
boutinb:editImageErrorDoesNotCrashEngine

Conversation

@boutinb

@boutinb boutinb commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes jasp-stats/jasp-issues#4615

Problem

When anything inside the try() in editImage fails, the engine crashes. interactiveJsonData is only assigned at the end of that block. So after an error, building the response fails outside the try with object 'interactiveJsonData' not found, and the engine logs Engine had an uncaught exception of: Error evaluating: jaspBase:::editImage(...) and dies.

To reproduce:

  1. Open Non-parametric Survival with debug.csv and a plot with a risk table.
  2. Untick all risk-table statistics.
  3. Edit the x-axis title.
  4. Tick Number at risk.

The plot becomes a patchwork, the desktop re-applies the stored edit, and the engine crashes.

Fix

Initialize interactiveJsonData <- NULL before the try. The error is then returned in the imageEdited response (error = TRUE, errorMessage), the same as other edit errors.

Testing

I ran editImage with stubbed loadJaspResults on a patchwork plot:

Related

🤖 Generated with Claude Code

interactiveJsonData was only assigned at the end of the try block, so any
error while editing (e.g. a re-applied edit on a plot that cannot be edited,
such as a patchwork) made building the response fail with "object
'interactiveJsonData' not found" outside the try, which killed the engine.
Initialize it up front so the error is returned in the imageEdited response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fatal error in plot editing

1 participant