I am not sure why I am getting this error can anyone help
int count=0;
positions curr=new positions(0,0);
while(count!=64) {
positions temp=null;
for(int i=0; i<p.length; i++) {
for(int j=0; j<p[0].length; j++) {
if(p[i][j].equals(curr)) {
while(temp.isVisited()!=true) {
ArrayList<positions> k =curr.getpositions(p, curr);
temp=k.get(0);
for(int l=1; l<k.size(); l++) {
if(k.get(l).getMoves()<temp.getMoves()) {
temp=k.get(l);
}
}
}
}
}
}
curr=temp;
solution[curr.getRow()][curr.getCol()]=count;
count++;
}
my error is Exception in thread "main" java.lang.NullPointerException: Cannot invoke "positions.getRow()" because "curr" is null at Main.main(Main.java:41)