Problem solved! updateGui() was actually messing things up as you mentioned, because it was reading the selected item text to update other widgets. The issue was simply fixed by testing if getSelectedItemIndex() returns -1 at the beginning of updateGui().
Thanks for your help @texus and @Kvar1z!
Thanks for your help @texus and @Kvar1z!