java – why am I missing a null pointer error exception?

I have a class called departments. In a main Jframe, I create an array of objects of this class and give a value to the first two positions of the array:

Here is how I declare the table:
enter the description of the image here

enter the description of the image here

Then, from a Jdialog, I try to get the data from the array to display them in a textArea:

enter the description of the image here

But when running it, I skip a null pointer exception in the line that tries to take the department number.
What is the reason for this if the array has values?