Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoding non-valid JSON silently quits basil scripts #148

Open
trych opened this issue Dec 19, 2016 · 0 comments
Open

Decoding non-valid JSON silently quits basil scripts #148

trych opened this issue Dec 19, 2016 · 0 comments
Labels

Comments

@trych
Copy link
Contributor

trych commented Dec 19, 2016

Hi there,
a student of our class just found this bug.

Take a non-valid JSON file (closing square bracket missing):

[
  {
    "id": 1,
    "level": 0,
    "centroid": 0,
    "bass": 0,
    "lowMid": 0,
    "mid": 0,
    "highMid": 0
  },
  {
    "id": 2,
    "level": 0,
    "centroid": 941.1855468750001,
    "bass": 0,
    "lowMid": 0,
    "mid": 1.6990291262135921,
    "highMid": 0
  }

and try to decode it with basil.js:

//@includepath "~/Documents/;%USERPROFILE%Documents";
//@include "basiljs/basil.js";

function draw() {
  b.clear(b.doc());

  //JSON
  var jsonString = b.loadString("buggy.json");

  var jsonData = b.JSON.decode( jsonString );

  b.println("Hello world!"); // --> does not print

  b.rect(0, 0, 100, 100); // --> does not draw

}

b.go();

basil does not throw any error but instead silently stops executing any commands after the b.JSON.decode().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant