Skip to content

Commit

Permalink
Fix crash on close of J2534 when the previous attempt to open has failed
Browse files Browse the repository at this point in the history
  • Loading branch information
antus committed Jul 28, 2024
1 parent 2e40689 commit a30b01e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Apps/PcmLibraryWindowsForms/Devices/J2534Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,14 @@ private Response<J2534Err> ConnectTool()
/// </summary>
private Response<J2534Err> DisconnectTool()
{
OBDError = J2534Port.Functions.Close((int)DeviceID);
if (OBDError != J2534Err.STATUS_NOERROR)
{
// Big problems, do something here
}
IsJ2534Open = false;
if (IsJ2534Open == true) {
OBDError = J2534Port.Functions.Close((int)DeviceID);
if (OBDError != J2534Err.STATUS_NOERROR)
{
// Big problems, do something here
}
IsJ2534Open = false;
}
return Response.Create(ResponseStatus.Success, OBDError);
}

Expand Down

0 comments on commit a30b01e

Please sign in to comment.