Permalink
Browse files

Fix possible NullReferenceException in ExternalTool.StartIntegrated().

  • Loading branch information...
1 parent e6967bb commit 771855fd078ebd25cdfa915458a4adc9ca7bd29d @rmcardle rmcardle committed Nov 18, 2013
Showing with 16 additions and 22 deletions.
  1. +16 −22 mRemoteV1/Tools/ExternalTool.vb
@@ -47,13 +47,13 @@ Namespace Tools
Try
If String.IsNullOrEmpty(_FileName) Then Throw New InvalidOperationException("FileName cannot be blank.")
+ ConnectionInfo = startConnectionInfo
+
If TryIntegrate Then
- StartIntegrated(startConnectionInfo)
+ StartIntegrated()
Return
End If
- ConnectionInfo = startConnectionInfo
-
Dim process As New Process()
With process.StartInfo
.UseShellExecute = True
@@ -70,27 +70,21 @@ Namespace Tools
End Sub
' Start external app integrated
- Public Sub StartIntegrated(Optional ByVal startConnectionInfo As Connection.Info = Nothing)
+ Public Sub StartIntegrated()
Try
- ConnectionInfo = startConnectionInfo
+ Dim newConnectionInfo As Connection.Info
+ If ConnectionInfo Is Nothing Then
+ newConnectionInfo = New Connection.Info
+ Else
+ newConnectionInfo = ConnectionInfo.Copy()
+ End If
- Dim newConnectionInfo As New Connection.Info
-
- newConnectionInfo.Protocol = Connection.Protocol.Protocols.IntApp
- newConnectionInfo.ExtApp = DisplayName
- newConnectionInfo.Name = DisplayName
- newConnectionInfo.Panel = "Int. Apps"
- newConnectionInfo.Hostname = ConnectionInfo.Hostname
- newConnectionInfo.Port = ConnectionInfo.Port
- newConnectionInfo.Username = ConnectionInfo.Username
- newConnectionInfo.Password = ConnectionInfo.Password
- newConnectionInfo.Domain = ConnectionInfo.Domain
- newConnectionInfo.Description = ConnectionInfo.Description
- newConnectionInfo.MacAddress = ConnectionInfo.MacAddress
- newConnectionInfo.UserField = ConnectionInfo.UserField
- newConnectionInfo.Description = ConnectionInfo.Description
- newConnectionInfo.PreExtApp = ConnectionInfo.PreExtApp
- newConnectionInfo.PostExtApp = ConnectionInfo.PostExtApp
+ With newConnectionInfo
+ .Protocol = Connection.Protocol.Protocols.IntApp
+ .ExtApp = DisplayName
+ .Name = DisplayName
+ .Panel = My.Language.strMenuExternalTools
+ End With
OpenConnection(newConnectionInfo)
Catch ex As Exception

0 comments on commit 771855f

Please sign in to comment.