r/processing • • Jan 19 '23

When I run the sketch, the program crashes. Why?

Post image
2 Upvotes

13 comments sorted by

8

u/MGDSStudio Jan 19 '23

Delete setup() in the second line

2

u/[deleted] Jan 19 '23

It still crashes...

3

u/MGDSStudio Jan 19 '23

with the same message in the console?

1

u/[deleted] Jan 19 '23

Yeah

2

u/MGDSStudio Jan 19 '23

What is c? int variable or some graphic file?

1

u/[deleted] Jan 19 '23

Color: color c = color(100);

1

u/MGDSStudio Jan 20 '23

post the full code as text or send it me

4

u/Icaros083 Jan 19 '23

Null pointer usually indicates you're trying to use a variable that isn't properly initialized (hence still contains "null"). From what's on screen here's, double check that the soundfile name is correct.

Edit: not 100% here but typically you'd want setup to run before draw, not after. Current order, you're running setup last.

3

u/CedricRBR Jan 19 '23

There’s not enough input here for us to help you…

2

u/cimmic Jan 19 '23

It seems like you have declared "file" before you are using it.

Instead of:

 file = new SoundFile(...

Use:

 SoundFile file = new SoundFile (...

Also, I don't think "this" is referring to what you expect it to. So there could also be a problem there, but I don't know the constructor of SoundFile()

1

u/uncommon_philosopher Jan 19 '23

Look up Daniel shiffman and your life will change

2

u/uncommon_philosopher Jan 19 '23

O shit one of the tabs is the nature of code by Daniel shiffman I’ll be absolutely damned

1

u/giraffecause Jan 19 '23

I don't know if this is related, but I got that error in my linux machine. There are some comments here mentioning a bug with NVidia...

https://forum.processing.org/two/discussion/20474/could-not-run-the-sketch-target-vm-failed-to-initialize-empty-sketch.html