Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
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
张蕾
Geth-Modification
Commits
cb009a5c
Commit
cb009a5c
authored
Mar 17, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rlp: don't panic for nil *big.Int
All other pointer types can handle nil just fine.
parent
86661de0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
encode.go
rlp/encode.go
+6
-1
encode_test.go
rlp/encode_test.go
+1
-0
No files found.
rlp/encode.go
View file @
cb009a5c
...
...
@@ -386,7 +386,12 @@ func writeUint(val reflect.Value, w *encbuf) error {
}
func
writeBigIntPtr
(
val
reflect
.
Value
,
w
*
encbuf
)
error
{
return
writeBigInt
(
val
.
Interface
()
.
(
*
big
.
Int
),
w
)
ptr
:=
val
.
Interface
()
.
(
*
big
.
Int
)
if
ptr
==
nil
{
w
.
str
=
append
(
w
.
str
,
0x80
)
return
nil
}
return
writeBigInt
(
ptr
,
w
)
}
func
writeBigIntNoPtr
(
val
reflect
.
Value
,
w
*
encbuf
)
error
{
...
...
rlp/encode_test.go
View file @
cb009a5c
...
...
@@ -196,6 +196,7 @@ var encTests = []encTest{
{
val
:
(
*
uint
)(
nil
),
output
:
"80"
},
{
val
:
(
*
string
)(
nil
),
output
:
"80"
},
{
val
:
(
*
[]
byte
)(
nil
),
output
:
"80"
},
{
val
:
(
*
big
.
Int
)(
nil
),
output
:
"80"
},
{
val
:
(
*
[]
string
)(
nil
),
output
:
"C0"
},
{
val
:
(
*
[]
interface
{})(
nil
),
output
:
"C0"
},
{
val
:
(
*
[]
struct
{
uint
})(
nil
),
output
:
"C0"
},
...
...
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