Method to insert a node in a list gives me error when inserting another node
Here is the code where I have problems:
public void insertar(int dato)
{
if(cabecera == null)
{
cabecera = new Nodo(dato);
}
else{
cabecera.setant(new Nodo(cabecera.getant(),dato,cabecera));
cabecera.getant().getant().setsig(cabecera.getant());
}
}