1

I'm afraid I have a problem with a "NullPointerException".

I'm writing a Processing (v4) Sketch, which should load multiple svg files from a folder, into a PShape Array. Initializing the array works fine, giving it a length works fine but somehow when I want to overwrite a value, I get a NullPointerException.

int imageCount = 1;
PShape[] images;


void setup() {
  images = new PShape[imageCount];

  for (int i = 0; i<images.length; i++) {
    println(images.length); //prints the expected result 1
    images[i] = loadShape("platzhalter/Platzhalter_2_"+str(i)+".svg"); 
    // throws NullPointerException
  }
}

I hope someone here can help me, thx!

George Profenza
  • 50,687
  • 19
  • 144
  • 218
dorndalf
  • 21
  • 3
  • does "platzhalter/Platzhalter_2_0.svg" exist either in the sketch folder or the data folder inside the sketch folder ? – George Profenza Apr 28 '22 at 11:45
  • @GeorgeProfenza yes, i have a folder called "platzhalter" in data and in that folder there is a file called Platzhalter_2_0.svg – dorndalf Apr 28 '22 at 12:01

1 Answers1

1

Okay so I solved it in the meantime. Turns out that processing has some kind of limitations in terms of interpreting svg files. I had to transform text to outlines in the adobe illustrator export settings to make it work. Hope this helps anyone with the same issue.

dorndalf
  • 21
  • 3