Skip to content

accidental call to print() with no arguments crashes browser #2765

Closed
@catarak

Description

@catarak

Nature of issue?

  • Found a bug
  • Existing feature enhancement
  • New feature request

Most appropriate sub-area of p5.js?

  • Color
  • Core
  • Data
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible): Environment

Which platform were you using when you encountered this?

  • Mobile/Tablet (touch devices)
  • Desktop/Laptop
  • Others (specify if possible)

Details about the bug:

Posted originally in processing/p5.js-web-editor#614

Calling print(x) with an undefined variable brings up the browser print dialog. I noticed that there was a similar issue over on processing/p5.js-web-editor#474 but that seemed to be more focused on calling print outside of setup or draw. In this case, it just happens if a variable becomes undefined.

One of my students stumbled across this by accidentally providing the dist function without enough parameters let x = dist(10, 35), which ended up returning undefined.

  • p5.js version: 0.6.0
  • Web browser and version: Chrome/Firefox/Safari
  • Operating System: MacOSX 10.12.6
  • Steps to reproduce this:Alpha editor link

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions