-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Labels
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
2.2.0
Web browser and version
Google Chrome Version 144.0.7559.61
Operating system
Windows 11
Steps to reproduce this
Description:
When invalid input is passed to text() or textWidth(), a friendly error message is correctly shown, but execution continues and results in a runtime exception inside the text renderer.
This appears inconsistent with other APIs where execution stops after a friendly error.
Steps:
- Open the p5.js Editor
- Run one of the following sketches
- Observe console output
Snippet:
function setup() {
createCanvas(200, 200);
text(null, 50, 50);
}
function setup() {
createCanvas(200, 200);
console.log(textWidth(null));
}
Expected Behaviour:
After a friendly error is reported, execution should stop or fail gracefully without throwing an internal runtime exception.
Actual Behaviour:
A friendly error is shown, but execution continues and crashes inside the text rendering internals.
Additional Notes:
- This behaviour is reproducible with null and undefined
- Similar friendly-error-then-crash patterns were not observed consistently across other APIs
- The crash originates from Renderer._processLines
I'm happy to take this on if this gets approved
Reactions are currently unavailable