NullPointerException?

Could someone help me?

When I import the 31st png file, I have an error :frowning:


PImage img;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
PImage img8;
PImage img9;
PImage img10;
PImage img11;
PImage img12;
PImage img13;
PImage img14;
PImage img15;
PImage img16;
PImage img17;
PImage img18;
PImage img19;
PImage img20;
PImage img21;
PImage img22;
PImage img23;
PImage img24;
PImage img25;
PImage img26;
PImage img27;
PImage img28;
PImage img29;
PImage img30;

void setup() {
   size(2900, 800);
  img = loadImage("logo.png");
  img1= loadImage("Asset 1@72x-8.png");
  img2= loadImage("Asset 2@72x-8.png");
  img3= loadImage("Asset 3@72x-8.png");
  img4= loadImage("Asset 4@72x-8.png");
  img5= loadImage("Asset 5@72x-8.png");
  img6= loadImage("Asset 6@72x-8.png");
  img7= loadImage("Asset 7@72x-8.png");
  img8= loadImage("Asset 8@72x-8.png");
  img9= loadImage("Asset 9@72x-8.png");
  img10= loadImage("Asset 10@72x-8.png");
  img11= loadImage("Asset 11@72x-8.png");
  img12= loadImage("Asset 12@72x-8.png");
  img13= loadImage("Asset 13@72x-8.png");
  img14= loadImage("Asset 14@72x-8.png");
  img15= loadImage("Asset 15@72x-8.png");
  img16= loadImage("Asset 16@72x-8.png");
  img17= loadImage("Asset 17@72x-8.png");
  img18= loadImage("Asset 18@72x-8.png");
  img19= loadImage("Asset 19@72x-8.png");
  img20= loadImage("Asset 20@72x-8.png");
  img21= loadImage("Asset 21@72x-8.png");
  img22= loadImage("Asset 22@72x-8.png");
  img23= loadImage("Asset 23@72x-8.png");
  img24= loadImage("Asset 24@72x-8.png");
  img25= loadImage("Asset 25@72x-8.png");
  img26= loadImage("Asset 26@72x-8.png");
  img27= loadImage("Asset 27@72x-8.png");
  img28= loadImage("Asset 28@72x-8.png");
  img28= loadImage("Asset 28@72x-8.png");
  img29= loadImage("Asset 29@72x-8.png");
  img30= loadImage("Asset 30@72x-8.png");

}

void draw() {
  background(#ffffff);
  
  image(img, 2350, 100);
  image(img, 2350, 100, 313.5857, 94.3059);
  
  image(img1, 140, 78);
  image(img1, 140, 78, 46.961, 46.9609);
  
  image(img2, 265, 103);
  image(img2, 265, 103, 97.5116, 97.5116);
  
  image(img3, 216, 174);
  image(img3, 216, 174, 46.961, 46.9609);
  
  image(img4, 400.92, 103.3369);
  image(img4, 400.92, 103.3369, 97.5116, 97.5116);
  
  image(img5, 124, 344);
  image(img5, 124, 344, 97.5116, 97.5116);
  
  image(img6, 182, 305);
  image(img6, 182, 305, 97.5116, 97.5116);
  
  image(img7, 200, 419);
  image(img7, 200, 419, 97.5116, 97.5116);
  
  image(img8, 249, 419);
  image(img8, 249, 419, 97.5116, 97.5116);
  
  image(img9, 139, 522);
  image(img9, 139, 522, 97.5116, 97.5116);
  
  image(img10, 190, 569);
  image(img10, 190, 569, 94.5698, 94.5696);
  
  image(img11, 93, 613);
  image(img11, 93, 613, 46.9609, 46.961);
  
  image(img12, 265, 522);
  image(img12, 265, 522, 97.5116, 97.5116);

  image(img13, 381, 200);
  image(img13, 381, 200, 189.23, 189.23);
  
  image(img14, 550, 203);
  image(img14, 550, 203, 94.5698, 94.5698);
  
  image(img15, 550, 296);
  image(img15, 550, 296, 94.5698, 94.5697);
  
  image(img16, 381, 300);
  image(img16, 381, 300, 189.2327, 189.2327);

  image(img17, 337, 587);
  image(img17, 337, 587, 97.5116, 97.5116);
  
  image(img18, 634, 650);
  image(img18, 634, 650, 97.5116 , 97.5116);
  
  image(img19, 750, 700);
  image(img19, 750, 700, 46.961, 46.9609);

  image(img20, 650, 200);
  image(img20, 650, 200, 347.7268, 347.7268);
  
  image(img21, 1000, 150);
  image(img21, 1000, 150, 46.961, 46.9609);
  
  image(img22, 954, 540);
  image(img22, 954, 540, 196.48, 196.4799);
  
  image(img23, 1164, 394);
  image(img23, 1164, 394, 97.5116, 97.5116);
  
  image(img24, 1090, 394);
  image(img24, 1090, 394, 97.5116, 97.5116);
  
  image(img25, 1157, 149);
  image(img25, 1157, 149, 97.1664, 97.1664);
  
  image(img26, 1100, 261);
  image(img26, 1100, 261, 97.5116, 97.5116);
  
  image(img27, 1000, 261);
  image(img27, 1000, 261, 97.5115, 97.5115);
  
  image(img28, 950, 700);
  image(img28, 950, 700, 46.961, 46.961);
  
  image(img29, 650, 174);
  image(img29, 650, 174, 46.961, 46.9609);
  
  image(img30, 853, 436);
  image(img30, 853, 436, 282.6586, 282.6587);
 
}

Asset 1 Asset 1@72x-8 Asset 2@72x-8 Asset 3@72x-8 Asset 4@72x-8 Asset 5@72x-8 Asset 6@72x-8 Asset 7@72x-8 Asset 8@72x-8 Asset 9@72x-8 Asset 10@72x-8 Asset 11@72x-8 Asset 12@72x-8 Asset 13@72x-8 Asset 14@72x-8 Asset 15@72x-8 Asset 16@72x-8 Asset 17@72x-8 Asset 18@72x-8 Asset 19@72x-8 Asset 20@72x-8 Asset 21@72x-8 Asset 22@72x-8 Asset 23@72x-8 Asset 24@72x-8 Asset 25@72x-8 Asset 26@72x-8 Asset 27@72x-8 Asset 28@72x-8 Asset 28@72x-8 Asset 30@72x-8 logo

Many thanks

Hi
Can you post the full error as seen in the console?

the doc states

If the file is not available or an error occurs, null will be returned and an error message will be printed to the console. The error message does not halt the program, however the null value may cause a NullPointerException if your code does not check whether the value returned is null.

==> double check that all file names are correct.

Memory limit of the JVM? Double check if all the images are correctly loaded (are you getting in the console an exception “java.lang.OutOfMemoryError: Java heap space”)