Skip to content

Conversation

@Homaid
Copy link

@Homaid Homaid commented Oct 25, 2025

Resolves #8198

Changes:
This PR adds validation for invalid numeric values in the arc() function to prevent silent failures and improve debugging.

What was added:

  • Added finite number validation for all numeric parameters (x, y, w, h, start, stop)
  • Added positive value validation for width and height parameters
  • Added helpful console warnings when invalid values are detected (Infinity, NaN, negative/zero dimensions)
  • Function now returns early when invalid values are passed, preventing rendering errors

Console shows clear warnings for:

  • Infinity values
  • NaN values
  • Negative width/height
  • Zero width/height

PR Checklist

p5._validateParameters('arc', arguments);

// Validate that numeric parameters are finite numbers
if (!Number.isFinite(x)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this works, but maybe let's wrap this all in an if statement that skips the check in the cases where FES is disabled. Currently I think that means checking if !p5.disableFriendlyErrors and typeof IS_MINIFIED === 'undefined' (see the setup for param validation here.)

@davepagurek
Copy link
Contributor

Also cc @ksen0 -- is this the kind of thing we want to hold off on merging until after the release candidate is fully released?

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.

arc() silently fails with Infinity/NaN values ( no console warnings)

3 participants