File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Source/ExcelDna.IntelliSense/UIMonitor Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -155,9 +155,22 @@ void UpdateSelectedItem()
155155 ListBounds = Win32Helper . GetWindowBounds ( _hwndPopupList ) ;
156156
157157 _selectedItemIndex = Win32Helper . GetListViewSelectedItemInfo ( hwndListView , out text , out itemBounds ) ;
158- itemBounds . Offset ( ListBounds . Left , ListBounds . Top ) ;
159- SelectedItemBounds = itemBounds ;
160- SelectedItemText = text ;
158+ if ( string . IsNullOrEmpty ( text ) )
159+ {
160+ // We (unexpectedly) failed to get information about the selected item
161+ Logger . WindowWatcher . Warn ( $ "PopupList UpdateSelectedItem - IsVisible but GetListViewSelectedItemInfo failed ") ;
162+ _selectedItemIndex = - 1 ;
163+ SelectedItemText = string . Empty ;
164+ SelectedItemBounds = Rect . Empty ;
165+ ListBounds = Rect . Empty ;
166+ }
167+ else
168+ {
169+ // Normal case - all is OK
170+ itemBounds . Offset ( ListBounds . Left , ListBounds . Top ) ;
171+ SelectedItemBounds = itemBounds ;
172+ SelectedItemText = text ;
173+ }
161174 }
162175 OnSelectedItemChanged ( ) ;
163176 }
You can’t perform that action at this time.
0 commit comments