SpriteSheet Loader Nullpointer Why?

Hello so when i try using the code below i get a nullpointer on line 36 and i dont c why.
Anny help is welcomed.

class Sprite
{
  int numRows, numCols;
  int posX, posY;
  int counter;
  PImage img;
  int partW, partH;
  int currWaitCtr, maxWaitCtr;
  PImage[][] states;
  
  Sprite(PImage img, int numRows, int numCols, int maxWaitCtr)
  {
    this(img, 0, 0, numRows, numCols, maxWaitCtr);
  }
  Sprite(PImage img, int posX, int posY, int numRows, int numCols, int maxWaitCtr)
  {
    this.img=img;
    this.numRows=numRows;
    this.numCols=numCols;
    this.posX=posX;
    this.posY=posY;
    this.partW=img.width/numCols;
    this.partH=img.height/numRows;
    this.counter=0;
    this.maxWaitCtr=maxWaitCtr;


    //state loader

    int w=this.img.width/this.numCols;
    int h=this.img.height/this.numRows;

    for (int r = 0; r < this.numRows; ++r) {
      for (int c = 0; c < this.numCols; ++c) {
        println("debug: " + "r =" +r+ " | c =" + c);
        this.states[r][c]=img.get(c*w, r*h, w, h);
      }
    }

  }


  void display()
  {
    int c = this.counter%this.numCols;
    int r = this.counter/this.numCols;
    int w=this.img.width/this.numCols;
    int h=this.img.height/this.numRows;

    PImage sprite = img.get(c*w, r*h, w, h);

    image(sprite, this.posX, this.posY);
  }



  void update()
  {
    this.currWaitCtr++;
    if(this.currWaitCtr>=this.maxWaitCtr)
    {
    this.counter++;
    this.counter%=this.numRows*this.numCols;
    this.currWaitCtr=0;
    }
  }
  void move(int deltaX, int deltaY, int rightBorder)
  {
   this.posX+=deltaX;
   this.posY+=deltaY;
   
   if(this.posX>rightBorder)
   {
    this.posX=-this.img.width/this.numCols; 
   }
  } 
}

Need to declare the array like this (untested)

Sprite(PImage img, int posX, int posY, int numRows, int numCols, int maxWaitCtr)
  {
    this.img=img;
    this.numRows=numRows;
    this.numCols=numCols;
    this.posX=posX;
    this.posY=posY;
    this.partW=img.width/numCols;
    this.partH=img.height/numRows;
    this.counter=0;
    this.maxWaitCtr=maxWaitCtr;

   this.sprites = new PImage[this.nbrRows][this.nbrCols];
    //state loader