File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
TortoiseGitToolbar/Config/Constants Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -74,11 +74,25 @@ public static string GetSolutionPath(Solution2 solution)
7474
7575 public static string GetOpenedFilePath ( Solution2 solution )
7676 {
77- return solution != null && solution . DTE != null && solution . DTE . ActiveDocument != null
77+ if ( solution != null && solution . DTE != null )
78+ {
79+ try
80+ {
81+ if ( solution . DTE . ActiveDocument == null ) // no active window
82+ return null ;
83+ }
84+ catch ( ArgumentException )
85+ {
86+ // active window is no file (e.g. the project properties)
87+ return null ;
88+ }
89+
7890 // GetExactPathName is needed because visual studio can provide lowercase path,
7991 // but git is case sensitive to file names
80- ? GetExactPathName ( solution . DTE . ActiveDocument . FullName )
81- : null ;
92+ return GetExactPathName ( solution . DTE . ActiveDocument . FullName ) ;
93+ }
94+
95+ return null ;
8296 }
8397
8498 /// <summary>
You can’t perform that action at this time.
0 commit comments