Whenever I try to compile this code that sets the grid for a QR code I get an error: Cannot load from object array because "QRCode.grid" is null at QRCode.setGrid(QRCode.java:76). I think there is an error in the last line.
public void setGrid(int dim, int [] pattern) {
if(pattern==null)
grid=new int[dim][dim];
for(int row=0;row<dim;row ) {
for(int col = 0; col < dim; col ) {
grid[i][j]=pattern[row*dim col];
}
}
}
CodePudding user response:
