File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,15 +169,16 @@ public bool ShowPopup
169169 IVsUIShell4 uiShell = Package . GetGlobalService ( typeof ( SVsUIShell ) ) as IVsUIShell4 ;
170170 if ( uiShell != null )
171171 {
172- IOleCommandTarget commandTarget = MarginCore . TextView . Properties . GetProperty < GitDiffMarginCommandHandler > ( typeof ( GitDiffMarginCommandHandler ) ) ;
172+ if ( MarginCore . TextView . Properties . TryGetProperty < GitDiffMarginCommandHandler > ( typeof ( GitDiffMarginCommandHandler ) , out var commandTarget ) )
173+ {
174+ IVsToolbarTrayHost toolbarTrayHost ;
175+ ErrorHandler . ThrowOnFailure ( uiShell . CreateToolbarTray ( commandTarget , out toolbarTrayHost ) ) ;
173176
174- IVsToolbarTrayHost toolbarTrayHost ;
175- ErrorHandler . ThrowOnFailure ( uiShell . CreateToolbarTray ( commandTarget , out toolbarTrayHost ) ) ;
177+ Guid toolBarGuid = typeof ( GitDiffMarginCommand ) . GUID ;
178+ ErrorHandler . ThrowOnFailure ( toolbarTrayHost . AddToolbar ( ref toolBarGuid , ( int ) GitDiffMarginCommand . GitDiffToolbar ) ) ;
176179
177- Guid toolBarGuid = typeof ( GitDiffMarginCommand ) . GUID ;
178- ErrorHandler . ThrowOnFailure ( toolbarTrayHost . AddToolbar ( ref toolBarGuid , ( int ) GitDiffMarginCommand . GitDiffToolbar ) ) ;
179-
180- _toolbarTrayHost = toolbarTrayHost ;
180+ _toolbarTrayHost = toolbarTrayHost ;
181+ }
181182 }
182183 }
183184 else
You can’t perform that action at this time.
0 commit comments