Skip to content

Commit

Permalink
Remove "if (...)" expressions that are always true
Browse files Browse the repository at this point in the history
  • Loading branch information
vbaderks committed Jan 30, 2018
1 parent fccf440 commit 861dc36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
8 changes: 3 additions & 5 deletions WinUSBNet/USBDevice.cs
Expand Up @@ -254,14 +254,12 @@ public IAsyncResult BeginControlTransfer(byte requestType, byte request, int val
}
catch (API.APIException e)
{
if (result != null)
result.Dispose();
throw new USBException("Asynchronous control transfer failed", e);
result.Dispose();
throw new USBException("Asynchronous control transfer failed", e);
}
catch (Exception)
{
if (result != null)
result.Dispose();
result.Dispose();
throw;
}
return result;
Expand Down
12 changes: 4 additions & 8 deletions WinUSBNet/USBPipe.cs
Expand Up @@ -179,14 +179,12 @@ public IAsyncResult BeginRead(byte[] buffer, int offset, int length, AsyncCallba
}
catch (API.APIException e)
{
if (result != null)
result.Dispose();
result.Dispose();
throw new USBException("Failed to read from pipe.", e);
}
catch (Exception)
{
if (result != null)
result.Dispose();
result.Dispose();
throw;
}
return result;
Expand Down Expand Up @@ -282,14 +280,12 @@ public IAsyncResult BeginWrite(byte[] buffer, int offset, int length, AsyncCallb
}
catch (API.APIException e)
{
if (result != null)
result.Dispose();
result.Dispose();
throw new USBException("Failed to write to pipe.", e);
}
catch (Exception)
{
if (result != null)
result.Dispose();
result.Dispose();
throw;
}
return result;
Expand Down

0 comments on commit 861dc36

Please sign in to comment.