Skip to content

Commit c1ae58d

Browse files
A-Ovchinnikov-mxA-Ovchinnikov-mx
A-Ovchinnikov-mx
authored and
A-Ovchinnikov-mx
committed
Improve git_remote_connect error handling
See libgit2/libgit2sharp#1913
1 parent 5466e56 commit c1ae58d

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

LibGit2Sharp/Core/Proxy.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -2154,17 +2154,11 @@ public static unsafe RemoteHandle git_remote_create_anonymous(RepositoryHandle r
21542154

21552155
public static unsafe void git_remote_connect(RemoteHandle remote, GitDirection direction, ref GitRemoteCallbacks remoteCallbacks, ref GitProxyOptions proxyOptions)
21562156
{
2157-
GitStrArrayManaged customHeaders = new GitStrArrayManaged();
2158-
2159-
try
2157+
using (var customHeaders = new GitStrArrayManaged())
21602158
{
21612159
int res = NativeMethods.git_remote_connect(remote, direction, ref remoteCallbacks, ref proxyOptions, ref customHeaders.Array);
21622160
Ensure.ZeroResult(res);
21632161
}
2164-
catch (Exception)
2165-
{
2166-
customHeaders.Dispose();
2167-
}
21682162
}
21692163

21702164
public static unsafe string git_remote_default_branch(RemoteHandle remote)

0 commit comments

Comments
 (0)