Hello! a new noob is here ^^

I`m getting the following error as I use clear() in a QListWidget from my ui:

Qt Code:
  1. ASSERT failure in QList<T>::operator[]: "index out of range", file ../../QT/2010.05/qt/include/QtCore/../../src/corelib/tools/qlist.h, line 463
To copy to clipboard, switch view to plain text mode 


the QListWidget is adding itens correctly, but it crashes as I try to remove them.
I tried using takeItem inside a for but the same error ocurred
Please help.


Qt Code:
  1. void MyDialog::on_remove_my_bt_clicked()
  2. {
  3. int currentIdx = ui->my_list->currentIndex().row();
  4. if(currentIdx>-1){
  5. listA.removeAt(currentIdx);
  6. if(listA.size()>0){
  7. updateMyList();
  8. }else{
  9. ui->my_list->clear();//<- error here
  10. listReady = false;
  11. }
  12. }
  13. }
  14.  
  15. void MyDialog::updateMyList()
  16. {
  17. ui->my_list->clear();//<- error here
  18. ...
  19. }
To copy to clipboard, switch view to plain text mode