Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
75d40918
Commit
75d40918
authored
Feb 06, 2016
by
Boaz Brickner
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68 from shargon/patch-1
Throw an exception if the buffer is null when creating a DataSegment.
parents
7d204fb5
aa011252
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
DataSegment.cs
PcapDotNet/src/PcapDotNet.Packets/DataSegment.cs
+5
-10
No files found.
PcapDotNet/src/PcapDotNet.Packets/DataSegment.cs
View file @
75d40918
...
...
@@ -23,15 +23,7 @@ namespace PcapDotNet.Packets
/// Take all the bytes as a segment.
/// </summary>
/// <param name="buffer">The buffer to take as a segment.</param>
public
DataSegment
(
byte
[]
buffer
)
{
if
(
buffer
==
null
)
throw
new
ArgumentNullException
(
"buffer"
);
Buffer
=
buffer
;
StartOffset
=
0
;
Length
=
buffer
.
Length
;
}
public
DataSegment
(
byte
[]
buffer
)
:
this
(
buffer
,
0
,
buffer
==
null
?
0
:
buffer
.
Length
)
{}
/// <summary>
/// Take only part of the bytes as a segment.
...
...
@@ -41,6 +33,9 @@ namespace PcapDotNet.Packets
/// <param name="length">The number of bytes to take.</param>
public
DataSegment
(
byte
[]
buffer
,
int
offset
,
int
length
)
{
if
(
buffer
==
null
)
throw
new
ArgumentNullException
(
"buffer"
);
Buffer
=
buffer
;
StartOffset
=
offset
;
Length
=
length
;
...
...
@@ -408,4 +403,4 @@ namespace PcapDotNet.Packets
private
static
readonly
DataSegment
_empty
=
new
DataSegment
(
new
byte
[
0
]);
}
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment