Buggy code:
public class IMatController { private IMatGUI mainFrame ; private IMatModel iMatModel ; private ShoppingListModel shoppingListModel ; public IMatController ( ) { } private void showProducts ( List < Product > productList ) { } private void saveUser ( ) { } public void shutdownRoutine ( ) { } private class productBoxListener implements MouseListener { @ Override public void mouseReleased ( MouseEvent e ) { } private void favouriteButtonClicked ( MouseEvent e ) { } private void addToCartButtonClicked ( MouseEvent e ) { } private void updateStoreCart ( ) { } @ Override public void mouseEntered ( MouseEvent e ) { } @ Override public void mouseExited ( MouseEvent e ) { } @ Override public void mouseClicked ( MouseEvent e ) { } @ Override public void mousePressed ( MouseEvent e ) { } } private class tabButtonListener implements ActionListener { @ Override public void actionPerformed ( ActionEvent e ) { CardLayout layout = ( ( CardLayout ) ( mainFrame . getMainPanel ( ) . getLayout ( ) ) ) ; layout . show ( mainFrame . getMainPanel ( ) , ( ( JButton ) ( e . getSource ( ) ) ) . getText ( ) ) ; } } private class toStoreButtonListener implements ActionListener { @ Override public void actionPerformed ( ActionEvent e ) { CardLayout layout = ( ( CardLayout ) ( mainFrame . getMainPanel ( ) . getLayout ( ) ) ) ; layout . show ( mainFrame . getMainPanel ( ) , "Butik" ) ; } } private class searchButtonListener implements ActionListener { @ Override public void actionPerformed ( ActionEvent e ) { mainFrame . clearProducts ( ) ; CardLayout layout = ( ( CardLayout ) ( mainFrame . getMainPanel ( ) . getLayout ( ) ) ) ; layout . show ( mainFrame . getMainPanel ( ) , "Butik" ) ; String searchTerm = mainFrame . getSearchFieldText ( ) ; if ( ( ( searchTerm . equals ( "" ) ) || ( searchTerm == null ) ) || ( searchTerm . equals ( "Sök..." ) ) ) { showProducts ( iMatModel . getAllProducts ( ) ) ; } else { showProducts ( iMatModel . findProducts ( searchTerm ) ) ; } mainFrame . setStoreHeaderLabel ( ( ( "Sökresultat<seq2seq4repair_space>för<seq2seq4repair_space>\"" + searchTerm ) + "\"" ) ) ; } } private class CategoryListener implements TreeSelectionListener { @ Override public void valueChanged ( TreeSelectionEvent e ) { } private void collapseAll ( JTree tree ) { } } private void showProductsMapMap ( Map < String , HashMap < String , ArrayList < Product > > > mapMap ) { } private void showProducts ( Map < String , ArrayList < Product > > map ) { } private class ShoppingCartControllerDocumentListener implements DocumentListener { @ Override public void insertUpdate ( DocumentEvent e ) { } @ Override public void removeUpdate ( DocumentEvent e ) { } @ Override public void changedUpdate ( DocumentEvent e ) { } } private class ShoppingCartControllerListener implements ActionListener { @ Override public void actionPerformed ( ActionEvent e ) { if ( e . getSource ( ) . getClass ( ) . equals ( new JButton ( ) . getClass ( ) ) ) { JButton button = ( ( JButton ) ( e . getSource ( ) ) ) ; if ( button . getName ( ) . equals ( "remove" ) ) { ShoppingCartListEntry entry = ( ( ShoppingCartListEntry ) ( button . getParent ( ) . getParent ( ) ) ) ; mainFrame . removeItem ( entry . getItem ( ) ) ; iMatModel . removeItemFromCart ( entry . getItem ( ) ) ; <START_BUG> if ( iMatModel . getCurrentProducts ( ) . isEmpty ( ) ) { <END_BUG> mainFrame . setCartButtonsEnabled ( false ) ; } } else if ( button . getName ( ) . equals ( "clearCart" ) ) { iMatModel . addToLastCart ( iMatModel . getItemsFromCart ( ) ) ; iMatModel . clearCart ( ) ; mainFrame . clearStoreCart ( ) ; mainFrame . getUndoClearButton ( ) . setVisible ( true ) ; } else if ( button . getName ( ) . equals ( "undoClear" ) ) { iMatModel . clearCart ( ) ; for ( ShoppingItem i : iMatModel . getLastCart ( ) ) { iMatModel . addItemToCart ( i ) ; } List < ShoppingItem > items = iMatModel . getItemsFromCart ( ) ; mainFrame . updateCartList ( items , ( ( ActionListener ) ( new IMatController . ShoppingCartControllerListener ( ) ) ) , new IMatController . ShoppingCartControllerDocumentListener ( ) ) ; iMatModel . clearLastCart ( ) ; mainFrame . getUndoClearButton ( ) . setVisible ( false ) ; } } } } }

Fix:
if ( iMatModel . getItemsFromCart ( ) . isEmpty ( ) ) {