I'm trying to use a getter for an object, in order to store the information of that object in another object. Yet, just by using the getter, it immediately returns a NullPointerException.
This is the code of the class that has the object as a field (and the getter):
public class NodoAnos implements Serializable
{
private int ano;
private NodoAnos proximo;
private ListaEquipos equipos;
public NodoAnos(int año) 
{
    this.ano = año;
    this.proximo = null;
    this.equipos = new ListaEquipos();
}
public int getAno() 
{
    return ano;
}
public void setAno(int año) 
{
    this.ano = año;
}
public ListaEquipos getEquipos()
{
    return equipos;
}
Here are all the methods before the NullPointerException (exception in code sample 6):
Code Sample 1:
private void informacion() throws IOException, FileNotFoundException, ClassNotFoundException
{
    int ano = elegirAnoPopup(); //SEE CODE SAMPLE NUMBER 2
    NodoAnos nodAno = new NodoAnos(ano);
    nodAno = anos.buscarAños(nodAno); //SEE CODE SAMPLE NUMBER 5
    datosComboBoxUniversidad(nodAno); //SEE CODE SAMPLE NUMBER 6
}
Code Sample 2:
private int elegirAnoPopup() throws IOException, FileNotFoundException, ClassNotFoundException
{
    NodoAnos aux = new NodoAnos(1);
    List<String> choices = new ArrayList<>();
    anos = anos.leerArchivo(anos); //SEE CODE SAMPLE NUMBER 3
    while(aux != null)
    {
        aux = anos.llenarDialogo(aux); //SEE CODE SAMPLE NUMBER 4
        if(aux != null)
            choices.add(Integer.toString(aux.getAno()));
    }
    ChoiceDialog<String> dialog = new ChoiceDialog<>("Elegir año",choices);
    dialog.setTitle("Consultar Informacion");
    dialog.setHeaderText("Por favor, introduzca la informacion requerida");
    dialog.setContentText("Introduzca el año a consultar:");
    Optional<String> result = dialog.showAndWait();
    return Integer.parseInt(result.get());
}
Code Sample 3:
public ListaAnos leerArchivo(ListaAnos anos) throws FileNotFoundException, IOException, ClassNotFoundException
{
    ListaAnos lista = anos;
    try
    {
        FileInputStream fis = new FileInputStream("lista.DAT");
        ObjectInputStream ois = new ObjectInputStream(fis);
        if(ois != null)
        {
            ListaAnos objeto = (ListaAnos) ois.readObject();
            lista = objeto;
            ois.close();
        }
    }
    catch(FileNotFoundException e)
    {
        System.out.println("No existe un archivo");
    }
    return lista;
}
Code Sample 4:
public NodoAnos llenarDialogo(NodoAnos aux)
{
    if(aux.getAno() == 1)
        aux = cabeza;
    else
        aux = aux.getProximo();
    return aux;
}
Code Sample 5:
public NodoAnos buscarAños(NodoAnos nodAño)
{
    NodoAnos aux = cabeza;
    while(aux != null)
    {
        if( nodAño.getAno() == aux.getAno() )
        {
            return aux;
        }
        else
        {
            aux = aux.getProximo();
        }
    }
    return null;
}
Code Sample Number 6:
private void datosComboBoxUniversidad(NodoAnos nodAno)
{
    ListaEquipos listaEquipo = new ListaEquipos();
    NodoEquipos nodEquipo = new NodoEquipos(null, 0, 0);
    listaEquipo = nodAno.getEquipos(); //NULLPOINTEREXCEPTION
    while(nodEquipo != null)
    {
        nodEquipo = listaEquipo.buscarEquipos(nodEquipo);
        if(nodEquipo != null)
        {
            comboUniversidad.getItems().add(nodEquipo.getUniversidad());
        }
    }
}
IMPORTANT NOTE: nodAno is not Null. Already made sure of it. it prints as follows: torneodetenis.NodoAnos@12539123
 
    