Buggy code:
RECT focusRect ; int headerToolTipHandle ; boolean ignoreCustomDraw ; boolean ignoreDrawForeground ; boolean ignoreDrawBackground ; boolean ignoreDrawFocus ; boolean ignoreDrawSelection ; boolean ignoreDrawHot ; boolean customDraw ; boolean dragStarted ; boolean explorerTheme ; boolean firstColumnImage ; boolean fixScrollWidth ; boolean tipRequested ; boolean wasSelected ; boolean wasResized ; boolean painted ; boolean ignoreActivate ; boolean ignoreSelect ; boolean ignoreShrink ; boolean ignoreResize ; boolean ignoreColumnMove ; boolean ignoreColumnResize ; boolean fullRowSelect ; int itemHeight ; int lastIndexOf ; int lastWidth ; int sortDirection ; int resizeCount ; int selectionForeground ; int hotIndex ; static int HeaderProc ; static final int INSET = 4 ; static final int GRID_WIDTH = 1 ; static final int SORT_WIDTH = 10 ; static final int HEADER_MARGIN = 12 ; static final int HEADER_EXTRA = 3 ; static final int VISTA_EXTRA = 2 ; static final int EXPLORER_EXTRA = 2 ; static final int H_SCROLL_LIMIT = 32 ; static final int V_SCROLL_LIMIT = 16 ; static final int DRAG_IMAGE_SIZE = 301 ; static final boolean EXPLORER_THEME = true ; static final int TableProc ; static final TCHAR TableClass = new TCHAR ( 0 , OS . WC_LISTVIEW , true ) ; public Table ( Composite parent , int style ) { } void _addListener ( int eventType , Listener listener ) { } TableItem _getItem ( int index ) { } public void addSelectionListener ( SelectionListener listener ) { } int callWindowProc ( int hwnd , int msg , int wParam , int lParam ) { } int callWindowProc ( int hwnd , int msg , int wParam , int lParam , boolean forceSelect ) { } static int checkStyle ( int style ) { } LRESULT CDDS_ITEMPOSTPAINT ( NMLVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_ITEMPREPAINT ( NMLVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_POSTPAINT ( NMLVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_PREPAINT ( NMLVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_SUBITEMPOSTPAINT ( NMLVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_SUBITEMPREPAINT ( NMLVCUSTOMDRAW nmcd , int wParam , int lParam ) { int hDC = nmcd . hdc ; if ( ( ( ( explorerTheme ) && ( ! ( ignoreCustomDraw ) ) ) && ( hooks ( EraseItem ) ) ) && ( ( nmcd . left ) != ( nmcd . right ) ) ) { OS . RestoreDC ( hDC , ( - 1 ) ) ; } TableItem item = _getItem ( ( ( int ) ( nmcd . dwItemSpec ) ) ) ; <START_BUG> if ( item == null ) <END_BUG> return null ; int hFont = item . fontHandle ( nmcd . iSubItem ) ; if ( hFont != ( - 1 ) ) OS . SelectObject ( hDC , hFont ) ; if ( ( ignoreCustomDraw ) || ( ( nmcd . left ) == ( nmcd . right ) ) ) { return new LRESULT ( ( hFont == ( - 1 ) ? OS . CDRF_DODEFAULT : OS . CDRF_NEWFONT ) ) ; } int code = OS . CDRF_DODEFAULT ; selectionForeground = - 1 ; ignoreDrawForeground = ignoreDrawSelection = ignoreDrawFocus = ignoreDrawBackground = false ; if ( OS . IsWindowVisible ( handle ) ) { Event measureEvent = null ; if ( hooks ( MeasureItem ) ) { measureEvent = sendMeasureItemEvent ( item , ( ( int ) ( nmcd . dwItemSpec ) ) , nmcd . iSubItem , nmcd . hdc ) ; if ( ( isDisposed ( ) ) || ( item . isDisposed ( ) ) ) return null ; } if ( hooks ( EraseItem ) ) { sendEraseItemEvent ( item , nmcd , lParam , measureEvent ) ; if ( ( isDisposed ( ) ) || ( item . isDisposed ( ) ) ) return null ; code |= OS . CDRF_NOTIFYPOSTPAINT ; } if ( ( ignoreDrawForeground ) || ( hooks ( PaintItem ) ) ) code |= OS . CDRF_NOTIFYPOSTPAINT ; } int clrText = ( ( item . cellForeground ) != null ) ? item . cellForeground [ nmcd . iSubItem ] : - 1 ; if ( clrText == ( - 1 ) ) clrText = item . foreground ; int clrTextBk = ( ( item . cellBackground ) != null ) ? item . cellBackground [ nmcd . iSubItem ] : - 1 ; if ( clrTextBk == ( - 1 ) ) clrTextBk = item . background ; if ( ( selectionForeground ) != ( - 1 ) ) clrText = selectionForeground ; if ( ( OS . IsWindowVisible ( handle ) ) && ( OS . IsWindowEnabled ( handle ) ) ) { if ( ( ( ! ( explorerTheme ) ) && ( ! ( ignoreDrawSelection ) ) ) && ( ( ( style ) & ( SWT . FULL_SELECTION ) ) != 0 ) ) { int bits = ( ( int ) ( OS . SendMessage ( handle , LVM_GETEXTENDEDLISTVIEWSTYLE , 0 , 0 ) ) ) ; if ( ( bits & ( OS . LVS_EX_FULLROWSELECT ) ) == 0 ) { LVITEM lvItem = new LVITEM ( ) ; lvItem . mask = OS . LVIF_STATE ; lvItem . stateMask = OS . LVIS_SELECTED ; lvItem . iItem = ( ( int ) ( nmcd . dwItemSpec ) ) ; int result = OS . SendMessage ( handle , LVM_GETITEM , 0 , lvItem ) ; if ( ( result != 0 ) && ( ( ( lvItem . state ) & ( OS . LVIS_SELECTED ) ) != 0 ) ) { int clrSelection = - 1 ;

Fix:
if ( ( item == null ) || ( item . isDisposed ( ) ) )